Xoshiro 256Plus Plus Class
Represents a pseudo-random number generator based on the Xoshiro256++ algorithm.
Definition
Namespace: Numerics.NET.Random
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
C#
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
public sealed class Xoshiro256PlusPlus : RandomSource<ScalarGenerator64<Xoshiro256PlusPlusEngine>>,
IRandomSourceFactory<Xoshiro256PlusPlus>, IAdvanceable, IJumpable- Inheritance
- Object → RandomSource<ScalarGenerator64<Xoshiro256PlusPlusEngine>> → Xoshiro256PlusPlus
- Implements
- IAdvanceable, IJumpable, IRandomSourceFactory<Xoshiro256PlusPlus>
Remarks
Use the Xoshiro256PlusPlus class to represent a pseudo-random number generator that uses the Xoshiro256++ algorithm by David Blackman and Sebastiano Vigna.
This generator has a period of 2256 - 1 and passes all statistical tests. It is one of the fastest high-quality generators and is the default in many modern systems.
The "++" scrambler provides excellent statistical properties for all use cases, combining the benefits of both Xoshiro256StarStar and Xoshiro256Plus.
Reference: David Blackman and Sebastiano Vigna. "Scrambled Linear Pseudorandom Number Generators." ACM Trans. Math. Softw. 2021.
Example
var rng = new Xoshiro256PlusPlus(789);
ulong value = rng.NextUInt64();
rng.LongJump();Constructors
| Xoshiro256Plus | Initializes a new instance of the Xoshiro256PlusPlus class using OS entropy. |
| Xoshiro256Plus | Initializes a new instance of the Xoshiro256PlusPlus class with the specified options. |
| Xoshiro256Plus | Initializes a new instance of the Xoshiro256PlusPlus class from saved state. |
| Xoshiro256Plus | Initializes a new instance of the Xoshiro256PlusPlus class with the specified seed. |
| Xoshiro256Plus | Initializes a new instance of the Xoshiro256PlusPlus class with the specified seed array. |
| Xoshiro256Plus | Initializes a new instance of the Xoshiro256PlusPlus class with the specified seed. |
| Xoshiro256Plus | Initializes a new instance of the Xoshiro256PlusPlus class with the specified seed array. |
| Xoshiro256Plus | Initializes a new instance of the Xoshiro256PlusPlus class with direct state initialization. |
Properties
| Bits |
Gets the number of bits per word in the generator's native output.
(Overrides RandomSource<TGenerator>.BitsPerWord) |
| Jump | Gets the size category of the primary jump operation. |
| Long | Gets the size category of the long jump operation. |
| Name |
Gets a human-readable name for this random number generator.
(Overrides RandomSource<TGenerator>.Name) |
| State |
Gets the number of bytes required to save/load this generator's state.
(Inherited from RandomSource<TGenerator>) |
| Uncached |
Gets an uncached facade for this random number generator.
(Inherited from RandomSource<TGenerator>) |
Methods
| Advance | Advances the generator state by the specified number of steps. |
| Copy | Creates an exact copy of this generator with the same state. |
| Create | Creates a new Xoshiro256PlusPlus instance from the specified options. |
| Create | Creates a jump-based stream partition for generating independent RNG streams. |
| Create | Creates a hierarchical stream tree for generating independent RNG streams. |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
| Fill( |
Fills a span with random 32-bit unsigned integer values.
(Inherited from RandomSource<TGenerator>) |
| Fill( |
Fills a span with random 32-bit signed integers less than the specified maximum.
(Inherited from RandomSource<TGenerator>) |
| Fill( |
Fills a span with random 64-bit signed integers less than the specified maximum.
(Inherited from RandomSource<TGenerator>) |
| Fill( |
Fills a span with random 32-bit signed integers within a specified range.
(Inherited from RandomSource<TGenerator>) |
| Fill( |
Fills a span with random 64-bit signed integers within a specified range.
(Inherited from RandomSource<TGenerator>) |
| Get | Serves as the default hash function. (Inherited from Object) |
| Get |
Returns the current state of the generator as a byte array.
(Inherited from RandomSource<TGenerator>) |
| Get | Gets the Type of the current instance. (Inherited from Object) |
| Jumped | Returns a new instance of the random number generator that is advanced by a specified number of jumps in the sequence. |
| Load |
Loads the generator's state from the source span in a stable little-endian format.
(Inherited from RandomSource<TGenerator>) |
| Long | Returns a new instance of the random number generator that is advanced by a specified number of long jumps in the sequence. |
| Next() |
Returns a non-negative random integer.
(Inherited from RandomSource<TGenerator>) |
| Next( |
Returns a non-negative random integer less than the specified maximum.
(Inherited from RandomSource<TGenerator>) |
| Next( |
Returns a random integer within a specified range.
(Inherited from RandomSource<TGenerator>) |
| Next |
Fills the elements of a specified array of bytes with random numbers.
(Inherited from RandomSource<TGenerator>) |
| Next |
Fills the elements of a specified span of bytes with random numbers.
(Inherited from RandomSource<TGenerator>) |
| Next |
Fills the elements of a specified span of bytes with random numbers.
(Inherited from RandomSource<TGenerator>) |
| Next |
Fills the elements of a specified span of bytes with random numbers.
(Inherited from RandomSource<TGenerator>) |
| Next |
Returns a random floating-point number in the range [0.0, 1.0).
(Inherited from RandomSource<TGenerator>) |
| Next |
Returns a non-negative random 64-bit integer.
(Inherited from RandomSource<TGenerator>) |
| Next |
Returns a non-negative random 64-bit integer less than the specified maximum.
(Inherited from RandomSource<TGenerator>) |
| Next |
Returns a random 64-bit integer within a specified range.
(Inherited from RandomSource<TGenerator>) |
| Next |
Returns a random single-precision floating-point number in the range [0.0, 1.0).
(Inherited from RandomSource<TGenerator>) |
| Next |
Returns a random 32-bit unsigned integer.
(Inherited from RandomSource<TGenerator>) |
| Next |
Returns a random 64-bit unsigned integer.
(Inherited from RandomSource<TGenerator>) |
| Reinitialize |
Reinitializes this random number generator using the specified initialization options.
(Inherited from RandomSource<TGenerator>) |
| Save |
Saves the generator's state to the destination span in a stable little-endian format.
(Inherited from RandomSource<TGenerator>) |
| ToString | Returns a string that represents the current object. (Inherited from Object) |