-
-
Notifications
You must be signed in to change notification settings - Fork 1
Documentation
All PRNG or RNG have implement interface IRNG
.
All RNG's can be divided into 2, based on internal state:
- Random 32-bit
- Random 64-bit
Here's the struture:
- IRNG
- Random32
- rng 32 bit
- Random64
- rng 64 bit
- Random32
- AlgorithmName()
- Reseed()
- NextBoolean()
- NextByte()
- NextByte(byte lower, byte upper)
- NextBytes(int length)
- NextInt()
- NextInt(uint lower, uint upper)
- NextLong()
- NextLong(ulong lower, ulong upper)
- NextDouble()
- NextDouble(double lower, double upper)
Return the name of the algorithm this RNG implements.
Seed the internal state from System.Security.Cryptography.RNGCryptoServiceProvider
.
If you want to manually seed the RNG or internal state, please create new instance. Because all RNG have different how they accept the seed, some accept 1 seed and some accept multiple seed.
Return a random C# true
or C# false
.
Return a random value from 0 to 255.
Return random number between lower
and upper
but the value must be in range 0 to 255.
-
lower
The lower bound or minimal value to generate.
-
upper
The upper bound or maximal value to generate.
-
ArgumentException
The lower bound must not be greater than or equal to the upper bound.
Return array of bytes with length as requested.
-
length
Requested size or length of array.
Return a 32-bit unsigned integer.
Return random number between lower
and upper
but the value must be in range 0 to 4,294,967,295.
-
lower
The lower bound or minimal value to generate.
-
upper
The upper bound or maximal value to generate.
-
ArgumentException
The lower bound must not be greater than or equal to the upper bound.
Return a 64-bit unsigned integer.
Return random number between lower
and upper
but the value must be in range 0 to 18,446,744,073,709,551,615.
-
lower
The lower bound or minimal value to generate.
-
upper
The upper bound or maximal value to generate.
-
ArgumentException
The lower bound must not be greater than or equal to the upper bound.
Return a 64-bit floating point.
Return random number between lower
and upper
.
-
lower
The lower bound or minimal value to generate.
-
upper
The upper bound or maximal value to generate.
-
ArgumentException
The lower bound must not be greater than or equal to the upper bound.
This method only exist in Random32
and Random64
only