(C Series?) Guessing Game 1-4
|
04-27-2018, 09:48 PM
(This post was last modified: 04-27-2018 09:52 PM by Dieter.)
Post: #4
|
|||
|
|||
RE: (C Series?) Guessing Game 1-4
(04-27-2018 08:49 PM)SamE Wrote: Actually, I failed to realize until you told me that that it calculated between zero and four. And I'm not sure if there's a way to just calculate a number between one and four from the RAN# function, I'm working with the knowledge I have. If there is a way to calculate a number between 0 and 9 there also is a way to calculate one between 0 and 4. Or 1 and 4, for that matter. ;-) (1) RAN# returns a random number between 0 and 0,9999... (2) Multiply this by 4 and you get something between 0 and 3,9999... (3) Take the integer part and get an integer between 0 and 3. (4) Add 1 and get the desired result between 1 and 4. So it's Code: RAN# Note: There is a tiny problem due to numeric limiations that may cause step (2) to return 4 instead of 3,9999..., but let's forget about this here – the chance for this to happen is 1 : 10 000 000 000. Dieter |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(C Series?) Guessing Game 1-4 - SamE - 04-27-2018, 06:49 PM
RE: (C Series?) Guessing Game 1-4 - Dieter - 04-27-2018, 07:34 PM
RE: (C Series?) Guessing Game 1-4 - SamE - 04-27-2018, 08:49 PM
RE: (C Series?) Guessing Game 1-4 - Dieter - 04-27-2018 09:48 PM
|
User(s) browsing this thread: 2 Guest(s)