LimeSurvey API - Master branch

MersenneTwister
in package

Custom random algorithm to get consistent behaviour between PHP versions.

Copied from: http://www.dr-chuck.com/csev-blog/2015/09/a-mersenne_twister-implementation-in-php/

Table of Contents

Properties

$index  : mixed
$instance  : MersenneTwister
Singleton variable
$state  : mixed

Methods

__construct()  : mixed
getInstance()  : MersenneTwister
getNext()  : mixed
init()  : void
setSeed()  : mixed
shuffle()  : array<string|int, mixed>
Shuffle with seed
generateTwister()  : mixed

Properties

Methods

__construct()

public __construct([int $seed = null ]) : mixed
Parameters
$seed : int = null

getNext()

public getNext([int $min = null ][, int $max = null ]) : mixed
Parameters
$min : int = null
$max : int = null

setSeed()

public setSeed(int $seed) : mixed
Parameters
$seed : int

shuffle()

Shuffle with seed

public shuffle(array<string|int, mixed> $arr) : array<string|int, mixed>
Parameters
$arr : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results