Documentation ¶
Index ¶
- Variables
- func ReduceUint32(src, mod uint32) uint32
- func ReduceUint64(src, mod uint64) uint64
- type PRNG
- func (prng *PRNG) ReadUint32AddIfShiftXOR(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint32AddIfShiftXORWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint32AddRotate(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint32AddRotateMultiply(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint32AddRotateMultiplyWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint32AddRotateWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint32MultiplyAdd(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint32MultiplyAddWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint32PCG(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint32PCGWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint32Xorshift(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint32XorshiftWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint64AddIfShiftXOR(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint64AddIfShiftXORWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint64AddNRotateMultiply(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint64AddNRotateMultiplyWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint64AddRotate(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint64AddRotateMultiply(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint64AddRotateMultiplyWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint64AddRotateWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint64MSWS(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint64MSWSWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint64MultiplyAdd(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint64MultiplyAddWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint64Xorshift(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint64XorshiftWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint64Xoshiro256(b []byte) (l int, err error)
- func (prng *PRNG) ReadUint64Xoshiro256WithReseed(b []byte) (l int, err error)
- func (prng *PRNG) Reseed()
- func (prng *PRNG) SetSeed(seed uint64)
- func (prng *PRNG) Uint32AddIfShiftXOR() uint32
- func (prng *PRNG) Uint32AddRotate() uint32
- func (prng *PRNG) Uint32AddRotateMultiply() uint32
- func (prng *PRNG) Uint32MultiplyAdd() uint32
- func (prng *PRNG) Uint32PCG() uint32
- func (prng *PRNG) Uint32Xorshift() uint32
- func (prng *PRNG) Uint64AddIfShiftXOR() uint64
- func (prng *PRNG) Uint64AddNRotateMultiply() uint64
- func (prng *PRNG) Uint64AddRotate() uint64
- func (prng *PRNG) Uint64AddRotateMultiply() uint64
- func (prng *PRNG) Uint64CpuTicks() uint64
- func (prng *PRNG) Uint64MSWS() uint64
- func (prng *PRNG) Uint64MultiplyAdd() uint64
- func (prng *PRNG) Uint64Xorshift() uint64
- func (prng *PRNG) Uint64Xoshiro256() (result uint64)
- func (prng *PRNG) XORReadUint32AddIfShiftXOR(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint32AddIfShiftXORWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint32AddRotate(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint32AddRotateMultiply(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint32AddRotateMultiplyWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint32AddRotateWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint32MultiplyAdd(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint32MultiplyAddWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint32PCG(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint32PCGWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint32Xorshift(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint32XorshiftWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint64AddIfShiftXOR(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint64AddIfShiftXORWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint64AddNRotateMultiply(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint64AddNRotateMultiplyWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint64AddRotate(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint64AddRotateMultiply(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint64AddRotateMultiplyWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint64AddRotateWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint64MSWS(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint64MSWSWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint64MultiplyAdd(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint64MultiplyAddWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint64Xorshift(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint64XorshiftWithReseed(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint64Xoshiro256(b []byte) (l int, err error)
- func (prng *PRNG) XORReadUint64Xoshiro256WithReseed(b []byte) (l int, err error)
Constants ¶
This section is empty.
Variables ¶
var ( // GlobalPRNG is just an initialized (ready-to-use) PRNG which could // be used from anywhere. GlobalPRNG = New() )
Functions ¶
func ReduceUint32 ¶
ReduceUint32 returns `src` as a value smaller than `mod`.
Based on: http://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/
For fair distribution of results `src` shouldn't be reduced, it should be an uint32 mathrandom number [0..2^32).
func ReduceUint64 ¶
ReduceUint64 returns `src` as a value smaller than `mod`.
Types ¶
type PRNG ¶
type PRNG struct {
// contains filtered or unexported fields
}
PRNG is a instance of a pseudo-mathrandom number generator.
func New ¶
func New() *PRNG
New creates new instance of pseudo-mathrandom number generator.
Methods of PRNG are not thread-safe in formal terms (which is usually not important for an PRNG) and it sometimes may return the same value to concurrent routines. If you need a non-copy guarantee among concurrent calls of a method (for example for "nonce") then you can use different instances of mathrand.PRNG for different goroutines. Also if you use a random number for example for sampling then you can safely use this function (because such errors won't make any negative effect to your application).
And example for multiple goroutines:
var prngPool = sync.Pool{New: func() interface{}{ return mathrand.New() }} ... prng := prngPool.Get().(*mathrand.PRNG). prng.ReadUint64Xoshiro256(b) prngPoo.Put(prng)
Note: Random numbers of this PRNG could easily be predicted (it's not an analog of crypto/rand).
func NewWithSeed ¶
NewWithSeed is the same as `New` but initializes the PRNG with predefined seed.
func (*PRNG) ReadUint32AddIfShiftXOR ¶
ReadUint32AddIfShiftXOR is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
Applied PRNG method: Uint32AddIfShiftXOR is a very fast (but weak) analog of `math/rand.Uint32`.
func (*PRNG) ReadUint32AddIfShiftXORWithReseed ¶
ReadUint32AddIfShiftXORWithReseed is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
"Reseed" forces to use a new seed (generated using XORShift method) on setting value to a pointer `& 0xff < 4`. Sometimes it allows to improve randomness of random numbers with a small performance impact. This method makes sense only if len(b) is large enough (>= 256 bytes). Otherwise it could affect strongly performance or it will not improve the randomness.
Applied PRNG method: Uint32AddIfShiftXOR is a very fast (but weak) analog of `math/rand.Uint32`.
func (*PRNG) ReadUint32AddRotate ¶
ReadUint32AddRotate is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
Applied PRNG method: Uint32AddRotate is a very fast (but weak) analog of `math/rand.Uint32`.
func (*PRNG) ReadUint32AddRotateMultiply ¶
ReadUint32AddRotateMultiply is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
Applied PRNG method: Uint32AddRotateMultiply is a fast analog of `math/rand.Uint32`.
The reliability on statistical tests of this method is unknown. This is improved LCG method, so see also Uint32MultiplyAdd.
func (*PRNG) ReadUint32AddRotateMultiplyWithReseed ¶
ReadUint32AddRotateMultiplyWithReseed is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
"Reseed" forces to use a new seed (generated using XORShift method) on setting value to a pointer `& 0xff < 4`. Sometimes it allows to improve randomness of random numbers with a small performance impact. This method makes sense only if len(b) is large enough (>= 256 bytes). Otherwise it could affect strongly performance or it will not improve the randomness.
Applied PRNG method: Uint32AddRotateMultiply is a fast analog of `math/rand.Uint32`.
The reliability on statistical tests of this method is unknown. This is improved LCG method, so see also Uint32MultiplyAdd.
func (*PRNG) ReadUint32AddRotateWithReseed ¶
ReadUint32AddRotateWithReseed is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
"Reseed" forces to use a new seed (generated using XORShift method) on setting value to a pointer `& 0xff < 4`. Sometimes it allows to improve randomness of random numbers with a small performance impact. This method makes sense only if len(b) is large enough (>= 256 bytes). Otherwise it could affect strongly performance or it will not improve the randomness.
Applied PRNG method: Uint32AddRotate is a very fast (but weak) analog of `math/rand.Uint32`.
func (*PRNG) ReadUint32MultiplyAdd ¶
ReadUint32MultiplyAdd is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
Applied PRNG method: Uint32MultiplyAdd is a fast (but week) analog of `math/rand.Uint32`.
See also: https://en.wikipedia.org/wiki/Linear_congruential_generator
func (*PRNG) ReadUint32MultiplyAddWithReseed ¶
ReadUint32MultiplyAddWithReseed is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
"Reseed" forces to use a new seed (generated using XORShift method) on setting value to a pointer `& 0xff < 4`. Sometimes it allows to improve randomness of random numbers with a small performance impact. This method makes sense only if len(b) is large enough (>= 256 bytes). Otherwise it could affect strongly performance or it will not improve the randomness.
Applied PRNG method: Uint32MultiplyAdd is a fast (but week) analog of `math/rand.Uint32`.
See also: https://en.wikipedia.org/wiki/Linear_congruential_generator
func (*PRNG) ReadUint32PCG ¶
ReadUint32PCG is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
Applied PRNG method: See also: https://en.wikipedia.org/wiki/Permuted_congruential_generator
func (*PRNG) ReadUint32PCGWithReseed ¶
ReadUint32PCGWithReseed is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
"Reseed" forces to use a new seed (generated using XORShift method) on setting value to a pointer `& 0xff < 4`. Sometimes it allows to improve randomness of random numbers with a small performance impact. This method makes sense only if len(b) is large enough (>= 256 bytes). Otherwise it could affect strongly performance or it will not improve the randomness.
Applied PRNG method: See also: https://en.wikipedia.org/wiki/Permuted_congruential_generator
func (*PRNG) ReadUint32Xorshift ¶
ReadUint32Xorshift is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
Applied PRNG method: Uint32Xorshift is a very fast (but weak) analog of `math/rand.Uint32`.
See also: https://en.wikipedia.org/wiki/Xorshift
func (*PRNG) ReadUint32XorshiftWithReseed ¶
ReadUint32XorshiftWithReseed is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
"Reseed" forces to use a new seed (generated using XORShift method) on setting value to a pointer `& 0xff < 4`. Sometimes it allows to improve randomness of random numbers with a small performance impact. This method makes sense only if len(b) is large enough (>= 256 bytes). Otherwise it could affect strongly performance or it will not improve the randomness.
Applied PRNG method: Uint32Xorshift is a very fast (but weak) analog of `math/rand.Uint32`.
See also: https://en.wikipedia.org/wiki/Xorshift
func (*PRNG) ReadUint64AddIfShiftXOR ¶
ReadUint64AddIfShiftXOR is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
Applied PRNG method: Uint64AddIfShiftXOR is a very fast (but weak) analog of `math/rand.Uint32`.
func (*PRNG) ReadUint64AddIfShiftXORWithReseed ¶
ReadUint64AddIfShiftXORWithReseed is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
"Reseed" forces to use a new seed (generated using XORShift method) on setting value to a pointer `& 0xff < 8`. Sometimes it allows to improve randomness of random numbers with a small performance impact. This method makes sense only if len(b) is large enough (>= 256 bytes). Otherwise it could affect strongly performance or it will not improve the randomness.
Applied PRNG method: Uint64AddIfShiftXOR is a very fast (but weak) analog of `math/rand.Uint32`.
func (*PRNG) ReadUint64AddNRotateMultiply ¶
ReadUint64AddNRotateMultiply is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
Applied PRNG method: Uint64AddNRotateMultiply is a fast analog of `math/rand.Uint64`.
The reliability on statistical tests of this method is unknown. This is improved LCG method, so see also Uint64MultiplyAdd.
func (*PRNG) ReadUint64AddNRotateMultiplyWithReseed ¶
ReadUint64AddNRotateMultiplyWithReseed is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
"Reseed" forces to use a new seed (generated using XORShift method) on setting value to a pointer `& 0xff < 8`. Sometimes it allows to improve randomness of random numbers with a small performance impact. This method makes sense only if len(b) is large enough (>= 256 bytes). Otherwise it could affect strongly performance or it will not improve the randomness.
Applied PRNG method: Uint64AddNRotateMultiply is a fast analog of `math/rand.Uint64`.
The reliability on statistical tests of this method is unknown. This is improved LCG method, so see also Uint64MultiplyAdd.
func (*PRNG) ReadUint64AddRotate ¶
ReadUint64AddRotate is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
Applied PRNG method: Uint64AddRotate is a very fast (but weak) analog of `math/rand.Uint64`.
func (*PRNG) ReadUint64AddRotateMultiply ¶
ReadUint64AddRotateMultiply is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
Applied PRNG method: Uint64AddRotateMultiply is a fast analog of `math/rand.Uint64`.
The reliability on statistical tests of this method is unknown. This is improved LCG method, so see also Uint64MultiplyAdd.
func (*PRNG) ReadUint64AddRotateMultiplyWithReseed ¶
ReadUint64AddRotateMultiplyWithReseed is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
"Reseed" forces to use a new seed (generated using XORShift method) on setting value to a pointer `& 0xff < 8`. Sometimes it allows to improve randomness of random numbers with a small performance impact. This method makes sense only if len(b) is large enough (>= 256 bytes). Otherwise it could affect strongly performance or it will not improve the randomness.
Applied PRNG method: Uint64AddRotateMultiply is a fast analog of `math/rand.Uint64`.
The reliability on statistical tests of this method is unknown. This is improved LCG method, so see also Uint64MultiplyAdd.
func (*PRNG) ReadUint64AddRotateWithReseed ¶
ReadUint64AddRotateWithReseed is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
"Reseed" forces to use a new seed (generated using XORShift method) on setting value to a pointer `& 0xff < 8`. Sometimes it allows to improve randomness of random numbers with a small performance impact. This method makes sense only if len(b) is large enough (>= 256 bytes). Otherwise it could affect strongly performance or it will not improve the randomness.
Applied PRNG method: Uint64AddRotate is a very fast (but weak) analog of `math/rand.Uint64`.
func (*PRNG) ReadUint64MSWS ¶
ReadUint64MSWS is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
Applied PRNG method: See also: https://en.wikipedia.org/wiki/Middle-square_method
func (*PRNG) ReadUint64MSWSWithReseed ¶
ReadUint64MSWSWithReseed is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
"Reseed" forces to use a new seed (generated using XORShift method) on setting value to a pointer `& 0xff < 8`. Sometimes it allows to improve randomness of random numbers with a small performance impact. This method makes sense only if len(b) is large enough (>= 256 bytes). Otherwise it could affect strongly performance or it will not improve the randomness.
Applied PRNG method: See also: https://en.wikipedia.org/wiki/Middle-square_method
func (*PRNG) ReadUint64MultiplyAdd ¶
ReadUint64MultiplyAdd is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
Applied PRNG method: Uint64MultiplyAdd is a fast (but week) analog of `math/rand.Uint64`.
See also: https://en.wikipedia.org/wiki/Linear_congruential_generator
func (*PRNG) ReadUint64MultiplyAddWithReseed ¶
ReadUint64MultiplyAddWithReseed is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
"Reseed" forces to use a new seed (generated using XORShift method) on setting value to a pointer `& 0xff < 8`. Sometimes it allows to improve randomness of random numbers with a small performance impact. This method makes sense only if len(b) is large enough (>= 256 bytes). Otherwise it could affect strongly performance or it will not improve the randomness.
Applied PRNG method: Uint64MultiplyAdd is a fast (but week) analog of `math/rand.Uint64`.
See also: https://en.wikipedia.org/wiki/Linear_congruential_generator
func (*PRNG) ReadUint64Xorshift ¶
ReadUint64Xorshift is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
Applied PRNG method: Uint64Xorshift is a very fast (but weak) analog of `math/rand.Uint64`.
See also: https://en.wikipedia.org/wiki/Xorshift
func (*PRNG) ReadUint64XorshiftWithReseed ¶
ReadUint64XorshiftWithReseed is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
"Reseed" forces to use a new seed (generated using XORShift method) on setting value to a pointer `& 0xff < 8`. Sometimes it allows to improve randomness of random numbers with a small performance impact. This method makes sense only if len(b) is large enough (>= 256 bytes). Otherwise it could affect strongly performance or it will not improve the randomness.
Applied PRNG method: Uint64Xorshift is a very fast (but weak) analog of `math/rand.Uint64`.
See also: https://en.wikipedia.org/wiki/Xorshift
func (*PRNG) ReadUint64Xoshiro256 ¶
ReadUint64Xoshiro256 is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
Applied PRNG method: See also: https://en.wikipedia.org/wiki/Xorshift#xoshiro_and_xoroshiro
func (*PRNG) ReadUint64Xoshiro256WithReseed ¶
ReadUint64Xoshiro256WithReseed is an analog of math/rand.Read. This random numbers could easily be predicted (it's not an analog of crypto/rand.Read).
"Reseed" forces to use a new seed (generated using XORShift method) on setting value to a pointer `& 0xff < 8`. Sometimes it allows to improve randomness of random numbers with a small performance impact. This method makes sense only if len(b) is large enough (>= 256 bytes). Otherwise it could affect strongly performance or it will not improve the randomness.
Applied PRNG method: See also: https://en.wikipedia.org/wiki/Xorshift#xoshiro_and_xoroshiro
func (*PRNG) Uint32AddIfShiftXOR ¶
Uint32AddIfShiftXOR is a very fast (but weak) analog of `math/rand.Uint32`.
func (*PRNG) Uint32AddRotate ¶
Uint32AddRotate is a very fast (but weak) analog of `math/rand.Uint32`.
func (*PRNG) Uint32AddRotateMultiply ¶
Uint32AddRotateMultiply is a fast analog of `math/rand.Uint32`.
The reliability on statistical tests of this method is unknown. This is improved LCG method, so see also Uint32MultiplyAdd.
func (*PRNG) Uint32MultiplyAdd ¶
Uint32MultiplyAdd is a fast (but week) analog of `math/rand.Uint32`.
See also: https://en.wikipedia.org/wiki/Linear_congruential_generator
func (*PRNG) Uint32PCG ¶
See also: https://en.wikipedia.org/wiki/Permuted_congruential_generator
func (*PRNG) Uint32Xorshift ¶
Uint32Xorshift is a very fast (but weak) analog of `math/rand.Uint32`.
See also: https://en.wikipedia.org/wiki/Xorshift
func (*PRNG) Uint64AddIfShiftXOR ¶
Uint64AddIfShiftXOR is a very fast (but weak) analog of `math/rand.Uint64`.
func (*PRNG) Uint64AddNRotateMultiply ¶
Uint64AddNRotateMultiply is a fast analog of `math/rand.Uint64`.
The reliability on statistical tests of this method is unknown. This is improved LCG method, so see also Uint64MultiplyAdd.
func (*PRNG) Uint64AddRotate ¶
Uint64AddRotate is a very fast (but weak) analog of `math/rand.Uint64`.
func (*PRNG) Uint64AddRotateMultiply ¶
Uint64AddRotateMultiply is a fast analog of `math/rand.Uint64`.
The reliability on statistical tests of this method is unknown. This is improved LCG method, so see also Uint64MultiplyAdd.
func (*PRNG) Uint64CpuTicks ¶
Uint64CpuTicks returns current value of ticks count on AMD64 CPU
func (*PRNG) Uint64MSWS ¶
See also: https://en.wikipedia.org/wiki/Middle-square_method
func (*PRNG) Uint64MultiplyAdd ¶
Uint64MultiplyAdd is a fast (but week) analog of `math/rand.Uint64`.
See also: https://en.wikipedia.org/wiki/Linear_congruential_generator
func (*PRNG) Uint64Xorshift ¶
Uint64Xorshift is a very fast (but weak) analog of `math/rand.Uint64`.
See also: https://en.wikipedia.org/wiki/Xorshift
func (*PRNG) Uint64Xoshiro256 ¶
See also: https://en.wikipedia.org/wiki/Xorshift#xoshiro_and_xoroshiro
func (*PRNG) XORReadUint32AddIfShiftXOR ¶
XORReadUint32AddIfShiftXOR XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint32AddIfShiftXOR(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint32AddIfShiftXORWithReseed ¶
XORReadUint32AddIfShiftXORWithReseed XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint32AddIfShiftXORWithReseed(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint32AddRotate ¶
XORReadUint32AddRotate XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint32AddRotate(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint32AddRotateMultiply ¶
XORReadUint32AddRotateMultiply XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint32AddRotateMultiply(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint32AddRotateMultiplyWithReseed ¶
XORReadUint32AddRotateMultiplyWithReseed XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint32AddRotateMultiplyWithReseed(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint32AddRotateWithReseed ¶
XORReadUint32AddRotateWithReseed XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint32AddRotateWithReseed(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint32MultiplyAdd ¶
XORReadUint32MultiplyAdd XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint32MultiplyAdd(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint32MultiplyAddWithReseed ¶
XORReadUint32MultiplyAddWithReseed XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint32MultiplyAddWithReseed(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint32PCG ¶
XORReadUint32PCG XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint32PCG(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint32PCGWithReseed ¶
XORReadUint32PCGWithReseed XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint32PCGWithReseed(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint32Xorshift ¶
XORReadUint32Xorshift XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint32Xorshift(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint32XorshiftWithReseed ¶
XORReadUint32XorshiftWithReseed XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint32XorshiftWithReseed(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint64AddIfShiftXOR ¶
XORReadUint64AddIfShiftXOR XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint64AddIfShiftXOR(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint64AddIfShiftXORWithReseed ¶
XORReadUint64AddIfShiftXORWithReseed XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint64AddIfShiftXORWithReseed(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint64AddNRotateMultiply ¶
XORReadUint64AddNRotateMultiply XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint64AddNRotateMultiply(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint64AddNRotateMultiplyWithReseed ¶
XORReadUint64AddNRotateMultiplyWithReseed XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint64AddNRotateMultiplyWithReseed(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint64AddRotate ¶
XORReadUint64AddRotate XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint64AddRotate(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint64AddRotateMultiply ¶
XORReadUint64AddRotateMultiply XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint64AddRotateMultiply(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint64AddRotateMultiplyWithReseed ¶
XORReadUint64AddRotateMultiplyWithReseed XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint64AddRotateMultiplyWithReseed(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint64AddRotateWithReseed ¶
XORReadUint64AddRotateWithReseed XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint64AddRotateWithReseed(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint64MSWS ¶
XORReadUint64MSWS XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint64MSWS(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint64MSWSWithReseed ¶
XORReadUint64MSWSWithReseed XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint64MSWSWithReseed(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint64MultiplyAdd ¶
XORReadUint64MultiplyAdd XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint64MultiplyAdd(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint64MultiplyAddWithReseed ¶
XORReadUint64MultiplyAddWithReseed XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint64MultiplyAddWithReseed(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint64Xorshift ¶
XORReadUint64Xorshift XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint64Xorshift(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint64XorshiftWithReseed ¶
XORReadUint64XorshiftWithReseed XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint64XorshiftWithReseed(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint64Xoshiro256 ¶
XORReadUint64Xoshiro256 XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint64Xoshiro256(x) for i := range b { b[i] ^= x[i] }
func (*PRNG) XORReadUint64Xoshiro256WithReseed ¶
XORReadUint64Xoshiro256WithReseed XORs argument "b" with a pseudo-random value. The result is the same (but faster) as:
x := make([]byte, len(b)) mathrand.ReadUint64Xoshiro256WithReseed(x) for i := range b { b[i] ^= x[i] }