GetRandomInt
- Parameters
-
lowBound integer
The inclusive lower bound of the random number returned.
highBound integer
The inclusive higher bound of the random number returned.
- bug
If you call
GetRandomInt(INT_MIN, INT_MAX)
orGetRandomInt(INT_MAX, INT_MIN)
it will always return the same value, namelyINT_MIN
orINT_MAX
.- comment
Returns a random integer in the range [lowBound, highBound] (inclusive). Bounds may be negative, but should be lowBound <= highBound. When lowBound==highBound, always returns that number.
- note
See:
GetRandomReal
,SetRandomSeed
.- note
Desyncs! The random number generator is a global, shared resource. Do not change its state in local blocks asynchronously.
- note
See http://hiveworkshop.com/threads/random.286109#post-3073222 for an overview of the algorithm used.
- note
If lowBound > highBound then it just swaps the values.
- return type
integer
- Source code
native GetRandomInt takes integer lowBound, integer highBound returns integer
- Source
- random.j
- wc3modding.com
- GetRandomInt