random: Difference between revisions
Jump to navigation
Jump to search
m (changed some wording) |
m (How to get whole number) |
||
Line 35: | Line 35: | ||
The number returned is unlikely to be a whole number (e.g. 1, 4, 76, etc.). | The number returned is unlikely to be a whole number (e.g. 1, 4, 76, etc.). | ||
To return a whole number combine [[random]] and [[mod]] | To return a whole number combine [[random]] and [[mod]]: | ||
<pre>_ran = random 10 | |||
_ran = _ran - (_ran % 1) | |||
</pre> |
Revision as of 11:40, 31 July 2006
random x
Operand types:
x: Number
Type of returned value:
Description:
Random real value from 0 to x.
Example:
_rNumber = random 1
Comments
Be careful using random numbers in multiplayer, each client will come up with a different result.
See multiplayer tutorials for more general information about locality.
The number returned is unlikely to be a whole number (e.g. 1, 4, 76, etc.).
To return a whole number combine random and mod:
_ran = random 10 _ran = _ran - (_ran % 1)