A set of static helper functions to get random numbers.
All functions except one wraps around haxes Std.random().
The .float() function uses Math.random().
Static methods
staticinlineuint(?rangeLength:UInt):UInt
Returns a random UInt unsigned integer number. By default, rangeLength is set to null, which results in values from 0 to inclusive 0xFFFFFFFF.
Parameters:
rangeLength | random values will be into the range from 0 to rangeLength (exclusive) |
|---|
staticinlineuintLimit(minValue:UInt, maxValue:UInt):UInt
Returns a random UInt unsigned integer number whose value is limited by min and max (inclusive).
Parameters:
minValue | the minimal random value |
|---|---|
maxValue | the maximum random value |
staticinlineint(?rangeLength:Int):Int
Returns a random Int integer number. By default, rangeLength is set to null, which results in values from -2147483648 to inclusive 2147483647.
Parameters:
rangeLength | random values will be into the range from 0 to rangeLength (exclusive) |
|---|
staticinlineintLimit(minValue:Int, maxValue:Int):Int
Returns a random Int integer number whose value is limited by min and max (inclusive).
Parameters:
minValue | the minimal random value |
|---|---|
maxValue | the maximum random value |
staticinlinefloat(rangeLength:Float = 1.0):Float
Returns a random Float number. (using Math.random * rangeLength)
Parameters:
rangeLength | if not null the random values will be into the range from 0 to rangeLength (exclusive) |
|---|
staticinlinefloatLimit(minValue:Float, maxValue:Float):Float
Returns a random Float number whose value is limited by min and max (inclusive).
Parameters:
minValue | the minimal random value |
|---|---|
maxValue | the maximum random value |
staticinlinefast(rangeLength:Float = 1.0):Float
Returns a random Float number. This can be faster then .float(), but is less accurate.
Parameters:
minValue | the minimal random value |
|---|---|
maxValue | the maximum random value |
staticinlinefastLimit(minValue:Float, maxValue:Float):Float
Returns a random Float number whose value is limited by min and max (inclusive). This can be faster then .floatLimit(), but is less accurate.
Parameters:
minValue | the minimal random value |
|---|---|
maxValue | the maximum random value |