To generate pseudo random numbers by a Mersenne Twister.
The same seed results in the same sequence of random numbers.

Constructor

new(?seed:UInt)

Creates a new Random instance.

Parameters:

seed

(optional) the start-seed for the random sequence. If this value is null the seed will be Std.random()

Methods

seed(?seed:UInt):Void

Sets the seed of this instance to start a new sequence.

Parameters:

seed

(optional) the start-seed for the random sequence. If this value is null the seed will be Std.random()

inlineuint(?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)

inlineuintLimit(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

inlineint(?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)

inlineintLimit(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

@:value({ rangeLength : 1.0 })inlinefloat(rangeLength:Float = 1.0):Float

Returns a random Float number.

Parameters:

rangeLength

if not null the random values will be into the range from 0 to rangeLength (exclusive)

inlinefloatLimit(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

@:value({ rangeLength : 1.0 })inlinefast(rangeLength:Float = 1.0):Float

Returns a random Float number. This can faster then .float(), but is less accurate.

Parameters:

minValue

the minimal random value

maxValue

the maximum random value

inlinefastLimit(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