Alea
Non-cryptographic pseudo-random number generator
Loading...
Searching...
No Matches
Wikimedia\Alea\Alea Class Reference

Alea non-cryptographic pseudo-random number generator. More...

Public Member Functions

 __construct (... $args)
 Create a new pseudo-random number generator.
 
 random ()
 Get a float with 32 bits of randomness.
 
 uint32 ()
 Get a random 32-bit unsigned integer.
 
 fract53 ()
 Get a float with the full 53 bits of randomness.
 
 args ()
 
 exportState ()
 
 importState (array $i)
 

Static Public Member Functions

static version ()
 
static createWithState (array $i)
 Create a new generator synced with some exported state.
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Alea\Alea::__construct ( $args)

Create a new pseudo-random number generator.

Parameters
mixed...$args Seeds for the PRNG. Can be anything which can be converted to a string with 'strval'.

Member Function Documentation

◆ createWithState()

static Wikimedia\Alea\Alea::createWithState ( array $i)
static

Create a new generator synced with some exported state.

Parameters
array$iThe exported state of some other Alea PRNG.
Returns
Alea a new Alea PRNG.

◆ exportState()

Wikimedia\Alea\Alea::exportState ( )
Returns
array The exported state of this PRNG.

◆ fract53()

Wikimedia\Alea\Alea::fract53 ( )

Get a float with the full 53 bits of randomness.

Returns
float

◆ importState()

Wikimedia\Alea\Alea::importState ( array $i)
Parameters
array$iThe exported state of some other Alea PRNG.

◆ random()

Wikimedia\Alea\Alea::random ( )

Get a float with 32 bits of randomness.

Returns
float

◆ uint32()

Wikimedia\Alea\Alea::uint32 ( )

Get a random 32-bit unsigned integer.

Returns
int

The documentation for this class was generated from the following file: