Click or drag to resize
XorShift128Plus Class
An implementation of the IRandom interface using the 128-bit XorShift+ generator.
Inheritance Hierarchy

Namespace: Experilous.MakeItRandom
Assembly: Assembly-CSharp-firstpass (in Assembly-CSharp-firstpass.dll) Version: 0.0.0.0
Syntax
C#
[SerializableAttribute]
public sealed class XorShift128Plus : RandomBase

The XorShift128Plus type exposes the following members.

Properties
  NameDescription
Public propertyskipAheadMagnitude
The binary order of magnitude size of the interveral that SkipAhead skips over.
(Overrides RandomBaseskipAheadMagnitude.)
Public propertyskipBackMagnitude
The binary order of magnitude size of the interveral that SkipBack() skips over.
(Inherited from RandomBase.)
Public propertystepBitCount
The number of bits that the XorShift128+ engine naturally produces in a single step.
(Overrides RandomBasestepBitCount.)
Top
Methods
  NameDescription
Public methodAsSystemRandom
Adapts the random engine to the interface provided by Random, for use in interfaces that require this common .NET type.
(Overrides RandomBaseAsSystemRandom.)
Public methodClone
Creates an exact duplicate of the random engine, which will independently generate the same sequence of random values as this instance.
Public methodCopyStateFrom
Copies the state of the source XorShift128+ engine into this engine, so that this engine will independently generate the same sequence of random values as the source.
Public methodStatic memberCreate
Creates an instance of the XorShift128+ engine using mildly unpredictable data to initialize the engine's state.
Public methodStatic memberCreate(Int32)
Creates an instance of the XorShift128+ engine using the provided seed to initialize the engine's state.
Public methodStatic memberCreate(Int32)
Creates an instance of the XorShift128+ engine using the provided seed to initialize the engine's state.
Public methodStatic memberCreate(String)
Creates an instance of the XorShift128+ engine using the provided seed to initialize the engine's state.
Public methodStatic memberCreate(IBitGenerator)
Creates an instance of the XorShift128+ engine using the provided bitGenerator to initialize the engine's state.
Public methodStatic memberCreateWithState(Byte)
Creates an instance of the XorShift128+ engine using the provided stateArray data to directly initialize the engine's state.
Public methodStatic memberCreateWithState(UInt64, UInt64)
Creates an instance of the XorShift128+ engine using the provided state0 and state1 data to directly initialize the engine's state.
Public methodStatic memberCreateWithState(UInt32, UInt32, UInt32, UInt32)
Creates an instance of the XorShift128+ engine using the provided state0 through state3 data to directly initialize the engine's state.
Public methodMergeSeed
Reseed the pseudo-random engine with a combination of its current state and a transient value (such as system time).
(Inherited from RandomBase.)
Public methodMergeSeed(Int32)
Reseed the pseudo-random engine with a combination of its current state and the supplied integer value.
(Inherited from RandomBase.)
Public methodMergeSeed(Int32)
Reseed the pseudo-random engine with a combination of its current state and the supplied array of integer values.
(Inherited from RandomBase.)
Public methodMergeSeed(String)
Reseed the pseudo-random engine with a combination of its current state and the supplied string.
(Inherited from RandomBase.)
Public methodMergeSeed(IBitGenerator)
Reseed the XorShift128+ engine with a combination of its current state and the supplied bit generator.
(Overrides RandomBaseMergeSeed(IBitGenerator).)
Public methodNext32
Get the next 32 bits of pseudo-random generated data.
(Overrides RandomBaseNext32.)
Public methodNext64
Get the next 64 bits of pseudo-random generated data.
(Overrides RandomBaseNext64.)
Public methodNext64(UInt32, UInt32)
Get the next 64 bits of generated data as two 32-bit values.
(Overrides RandomBaseNext64(UInt32, UInt32).)
Public methodRestoreState(Byte)
Restores the XorShift128+ engine's internal state from a byte array which had been previously saved.
(Overrides RandomBaseRestoreState(Byte).)
Public methodRestoreState(UInt64, UInt64)
Restores the XorShift128+ engine's internal state from a pair of unsigned 64-bit integers which had been previously saved.
Public methodRestoreState(UInt32, UInt32, UInt32, UInt32)
Restores the XorShift128+ engine's internal state from a pair of unsigned 64-bit integers which had been previously saved.
Public methodSaveState
Saves the XorShift128+ engine's internal state as a byte array, which can be restored later.
(Overrides RandomBaseSaveState.)
Public methodSaveState(UInt64, UInt64)
Saves the XorShift128+ engine's internal state as a pair of unsigned 64-bit integers, which can be restored later.
Public methodSaveState(UInt32, UInt32, UInt32, UInt32)
Saves the XorShift128+ engine's internal state as a pair of unsigned 64-bit integers, which can be restored later.
Public methodSeed
Reseed the pseudo-random engine with a transient value (such as system time).
(Inherited from RandomBase.)
Public methodSeed(Int32)
Reseed the pseudo-random engine with the supplied integer value.
(Inherited from RandomBase.)
Public methodSeed(Int32)
Reseed the pseudo-random engine with the supplied array of integer values.
(Inherited from RandomBase.)
Public methodSeed(String)
Reseed the pseudo-random engine with the supplied string.
(Inherited from RandomBase.)
Public methodSeed(IBitGenerator)
Reseed the XorShift128+ engine with the supplied bit generator.
(Overrides RandomBaseSeed(IBitGenerator).)
Public methodSkipAhead
Quickly advances the state forward by 2^64 steps.
(Overrides RandomBaseSkipAhead.)
Public methodSkipBack
Reverses the state backward by a fixed number of iterations, generally in logarithmic time.
(Inherited from RandomBase.)
Public methodStep
Step the state ahead by a single iteration, and throw away the output.
(Overrides RandomBaseStep.)
Top
Remarks

This PRNG is based on Marsaglia's XorShift class of generators, and modified by Sebastiano Vigna in his paper Further scramblings of Marsaglia's xorshift generators.

As its name implies, it maintains 128 bits of state. It natively generates 64 bits of pseudo- random data at a time.

See Also