Random
in package
XorShift128Engine Random Number Noise, used for fast seeded values Most of the code in this class was adapted from the XorShift128Engine in the php-random library.
Table of Contents
- W = 88675123
- X = 123456789
- Y = 362436069
- Z = 521288629
- $seed : int
- $w : int
- $x : int
- $y : int
- $z : int
- __construct() : mixed
- getSeed() : int
- nextBoolean() : bool
- Returns a random boolean
- nextBoundedInt() : int
- nextFloat() : float
- Returns a float between 0.0 and 1.0 (inclusive)
- nextInt() : int
- Returns an 31-bit integer (not signed)
- nextRange() : int
- Returns a random integer between $start and $end
- nextSignedFloat() : float
- Returns a float between -1.0 and 1.0 (inclusive)
- nextSignedInt() : int
- Returns a 32-bit integer (signed)
- setSeed() : void
Constants
W
public
mixed
W
= 88675123
X
public
mixed
X
= 123456789
Y
public
mixed
Y
= 362436069
Z
public
mixed
Z
= 521288629
Properties
$seed
protected
int
$seed
$w
private
int
$w
$x
private
int
$x
$y
private
int
$y
$z
private
int
$z
Methods
__construct()
public
__construct([int $seed = -1 ]) : mixed
Parameters
- $seed : int = -1
-
Integer to be used as seed.
Return values
mixed —getSeed()
public
getSeed() : int
Return values
int —nextBoolean()
Returns a random boolean
public
nextBoolean() : bool
Return values
bool —nextBoundedInt()
public
nextBoundedInt(int $bound) : int
Parameters
- $bound : int
Return values
int —nextFloat()
Returns a float between 0.0 and 1.0 (inclusive)
public
nextFloat() : float
Return values
float —nextInt()
Returns an 31-bit integer (not signed)
public
nextInt() : int
Return values
int —nextRange()
Returns a random integer between $start and $end
public
nextRange([int $start = 0 ][, int $end = 0x7fffffff ]) : int
Parameters
- $start : int = 0
-
default 0
- $end : int = 0x7fffffff
-
default 0x7fffffff
Return values
int —nextSignedFloat()
Returns a float between -1.0 and 1.0 (inclusive)
public
nextSignedFloat() : float
Return values
float —nextSignedInt()
Returns a 32-bit integer (signed)
public
nextSignedInt() : int
Return values
int —setSeed()
public
setSeed(int $seed) : void
Parameters
- $seed : int
-
Integer to be used as seed.