Class XorShift128
A 128-bit implementation of a XorShift pseudo-random number generator.
public class XorShift128 : Random
- Inheritance
-
XorShift128
- Inherited Members
Remarks
Useful links:
Constructors
XorShift128()
public XorShift128()
XorShift128(int)
public XorShift128(int seed)
Parameters
seed
int
XorShift128(long)
public XorShift128(long seed)
Parameters
seed
long
Methods
Next()
Returns a non-negative random integer.
public override int Next()
Returns
Next(int, int)
Returns a random integer that is within a specified range.
public override int Next(int minValue, int maxValue)
Parameters
minValue
intThe inclusive lower bound of the random number returned.
maxValue
intThe exclusive upper bound of the random number returned.
maxValue
must be greater than or equal tominValue
.
Returns
- int
A 32-bit signed integer greater than or equal to
minValue
and less thanmaxValue
; that is, the range of return values includesminValue
but notmaxValue
. IfminValue
equalsmaxValue
,minValue
is returned.
Exceptions
- ArgumentOutOfRangeException
minValue
is greater thanmaxValue
.
NextBytes(byte[])
Fills the elements of a specified array of bytes with random numbers.
public override void NextBytes(byte[] buffer)
Parameters
buffer
byte[]An array of bytes to contain random numbers.
Exceptions
- ArgumentNullException
buffer
is null.
Sample()
Returns a random floating-point number between 0.0 and 1.0.
protected override double Sample()
Returns
- double
A double-precision floating point number that is greater than or equal to 0.0, and less than 1.0.