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) or GetRandomInt(INT_MAX, INT_MIN) it will always return the same value, namely INT_MIN or INT_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

If lowBound > highBound then it just swaps the values.

note

See http://hiveworkshop.com/threads/random.286109#post-3073222 for an overview of the algorithm used.

note

Desyncs! The random number generator is a global, shared resource. Do not change its state in local blocks asynchronously.

note

See: GetRandomReal, SetRandomSeed.

patch

1.00

return type
integer
Source code
native GetRandomInt takes integer lowBound, integer highBound returns integer
Source
common.j
wc3modding.com
GetRandomInt