|
-
Musical chair
Hello 
Sort of adding onto the other responses...
Math.random() gives you a random number between 0 and 1.
random(x) gives you a random integer from a list with length x starting at zero (in other words, a random integer from 0 to one less than x).
Because Math.random() always gives you an irrational number, Math.random()*x gives you an irrational number also...just with a different range.
So, if you want to make it rational again, just do Math.floor(Math.random()*x) to take away all decimal places.
So, random(x) is the same thing as Math.floor(Math.random()*x) except random(x) is now deprecated, as I've been told.
Just clarifying things a little
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|