The search keyword must be a single word (no spaces).

Function GetRandomInt

Line
3393
Location
common.j
Constant?
no
Type
native
Arguments
integer lowBound, integer highBound
Returns
integer
3393
native GetRandomInt takes integer lowBound, integer highBound returns integer
3394
native GetRandomReal takes real lowBound, real highBound returns real
3395
3396
native CreateUnitPool           takes nothing returns unitpool
3397
native DestroyUnitPool          takes unitpool whichPool returns nothing
3398
native UnitPoolAddUnitType      takes unitpool whichPool, integer unitId, real weight returns nothing

Information about GetRandomInt

City17 4 years
returns a random integer in interval [lowBound, highBound] (inclusive). Bounds may be negative, but should be lowBound <= highBound. When lowBound==highBound, always returns that number.

Bug: If lowBound, highBound are INT_MIN, INT_MAX (or swapped) then it returns the value passed as lowBound (INT_MIN, or if swapped INT_MAX)

TODO: Understand logic when lowBound > highBound
For algorithm see: https://www.hiveworkshop.com/threads/random.286109/post-3073222

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

See: GetRandomReal, SetRandomSeed
You must be logged in with a standard account to contribute.