m
→Example
m (cat) |
m (→Example) |
||
| Line 2: | Line 2: | ||
==Usage== | ==Usage== | ||
math.randomseed | math.randomseed(s); | ||
val = math.random([l, u]); | val = math.random([l, u]); | ||
| Line 19: | Line 19: | ||
> local x = math.random(); | > local x = math.random(); | ||
> = x | > = x | ||
0.34534 | 0.34534 [0 - 1[ | ||
> local x = math.random(100); | > local x = math.random(100); | ||
> = x | > = x | ||
53 | 53 [1 - 100] | ||
> local x = math.random(50, 52); | > local x = math.random(50, 52); | ||
51 | > = x | ||
51 [50 - 52] | |||
==Notes== | ==Notes== | ||
math.randomseed takes any kind of positive number, between 0 and 2^31-1. | |||
The range [0,1) of math.random is exclusive, meaning that you can '''never''' get 1.0 exactly. Note that the returned number is not an integer, except the special (very rare) case of 0. | |||
The other ranges of the functions are inclusive, and will always return integers. | |||
{{Template:WoW API}} | {{Template:WoW API}} | ||