random() as
random() as
- Started
- Last post
- 3 Responses
- stewart
when i have this:
random(4);
say the current output is 2.
i want the next output to be:
0, 1 or 3, and never 2x the same output.how?
- blaw0
this would check to see if the number is the same as the previous time and then adds one (if more than 4, sets the value to 1):
http://rafb.net/paste/results/Eu…
- dijitaq0
actually Math.random() method will return you a number greater than zero and less than 1.
random() function will return you a number between 0 and the value specified
- unfittoprint0
you could create an array of numbers
Math.round its length and retrieve the value
and delete out each key/index
shortening the array and never having the same result 2x.