geomc 1.0
A c++ linear algebra template library
Loading...
Searching...
No Matches
XoshiroRand Class Reference
Inheritance diagram for XoshiroRand:
Random

Public Member Functions

 XoshiroRand (uint64_t seed)
 
 XoshiroRand (const uint64_t entropy[4])
 
void rseed (uint64_t seed)
 Reset the generator's state with the bits of seed as its source of entropy.
 
template<typename F>
void seed (F &&entropy)
 
void seed (const uint64_t entropy[4])
 
uint64_t rand64 ()
 
uint32_t rand32 ()
 
template<typename T>
rand ()
 
template<typename T>
rand (T max)
 
template<typename T>
rand (T lo, T hi)
 
template<>
bool rand ()
 
template<>
unsigned int rand ()
 
template<>
int rand ()
 
template<>
unsigned long rand ()
 
template<>
long rand ()
 
template<>
unsigned long long rand ()
 
template<>
long long rand ()
 
template<>
float rand ()
 
template<>
double rand ()
 
template<>
unsigned int rand (unsigned int hi)
 
template<>
int rand (int hi)
 
template<>
unsigned long rand (unsigned long hi)
 
template<>
long rand (long hi)
 
template<>
unsigned long long rand (unsigned long long hi)
 
template<>
long long rand (long long hi)
 
template<>
float rand (float hi)
 
template<>
double rand (double hi)
 
template<>
int rand (int lo, int hi)
 
template<>
long long rand (long long lo, long long hi)
 
template<>
float rand (float lo, float hi)
 
template<>
double rand (double lo, double hi)
 
template<>
bool rand ()
 
template<>
unsigned int rand ()
 
template<>
int rand ()
 
template<>
unsigned long rand ()
 
template<>
long rand ()
 
template<>
unsigned long long rand ()
 
template<>
long long rand ()
 
template<>
float rand ()
 
template<>
double rand ()
 
template<>
unsigned int rand (unsigned int hi)
 
template<>
int rand (int hi)
 
template<>
unsigned long rand (unsigned long hi)
 
template<>
long rand (long hi)
 
template<>
unsigned long long rand (unsigned long long hi)
 
template<>
long long rand (long long hi)
 
template<>
float rand (float hi)
 
template<>
double rand (double hi)
 
template<>
int rand (int lo, int hi)
 
template<>
long long rand (long long lo, long long hi)
 
template<>
float rand (float lo, float hi)
 
template<>
double rand (double lo, double hi)
 

Protected Attributes

uint32_t _bitpool
 
unsigned int _bitsleft
 

Member Function Documentation

◆ rand() [1/24]

template<typename T>
T rand ( void )
inlineinherited

Produces a (pseudo-) random T with uniform distribution over the unit interval, if the unit interval is populated by T; or with uniform distribution over the entire space of possible T otherwise.

For example, rand<float>() returns a random float between 0 and 1.0, while rand<unsigned int>() returns a random uint between 0 and UINT_MAX.

◆ rand() [2/24]

template<>
bool rand ( )
inherited
Returns
A random boolean value.

◆ rand() [3/24]

template<>
unsigned int rand ( )
inherited
Returns
An unsigned int between 0 and UINT_MAX.

◆ rand() [4/24]

template<>
int rand ( )
inherited
Returns
An int between INT_MIN and INT_MAX.

◆ rand() [5/24]

template<>
unsigned long rand ( )
inherited
Returns
An unsigned long between 0 and ULONG_MAX.

◆ rand() [6/24]

template<>
long rand ( )
inherited
Returns
A long between LONG_MIN and LONG_MAX.

◆ rand() [7/24]

template<>
unsigned long long rand ( )
inherited
Returns
An unsigned long long betwen 0 and ULLONG_MAX.

◆ rand() [8/24]

template<>
long long rand ( )
inherited
Returns
A long long between LLONG_MIN and LLONG_MAX.

◆ rand() [9/24]

template<>
float rand ( )
inherited

Generate a floating-point value with uniform distribution between 0 and 1.0.

This method is preferable to use over the common practice of rand<int>() / (float)INT_MAX, as the latter excludes a large fraction of the representable floating point numbers between 0.0 and 1.0 (particularly those near zero), resulting in reduced entropy.

This method produces a number by carefully picking the bits of the exponent and mantissa explicitly, in such a way that the distibution remains uniform.

◆ rand() [10/24]

template<>
double rand ( )
inherited

Generate a floating-point value with uniform distribution between 0 and 1.0.

This method is preferable to use over the common practice of rand<int>() / (float)INT_MAX, as the latter excludes a large fraction of the representable floating point numbers between 0.0 and 1.0 (particularly those near zero), resulting in reduced entropy.

This method produces a number by carefully picking the bits of the exponent and mantissa explicitly, in such a way that the distibution remains uniform.

◆ rand() [11/24]

template<>
double rand ( double hi)
inherited
Parameters
hiUpper or lower bound of random number.
Returns
A double between 0 and hi, regardless of the sign of hi.

◆ rand() [12/24]

template<>
double rand ( double lo,
double hi )
inherited
Parameters
loLower bound of random number.
hiUpper bound of random number.
Returns
An double between lo and hi.

◆ rand() [13/24]

template<>
float rand ( float hi)
inherited
Parameters
hiUpper or lower bound of random number.
Returns
A float between 0 and hi, regardless of the sign of hi.

◆ rand() [14/24]

template<>
float rand ( float lo,
float hi )
inherited
Parameters
loLower bound of random number.
hiUpper bound of random number.
Returns
An float between lo and hi.

◆ rand() [15/24]

template<>
int rand ( int hi)
inherited
Parameters
hiUpper or lower bound of random number.
Returns
A number between 0 and hi (regardless of the sign of hi).

◆ rand() [16/24]

template<>
int rand ( int lo,
int hi )
inherited
Parameters
loLower bound of random number.
hiUpper bound of random number.
Returns
An int between lo and hi.

◆ rand() [17/24]

template<>
long rand ( long hi)
inherited
Parameters
hiUpper or lower bound of random number.
Returns
A long between 0 and hi, regardless of the sign of hi.

◆ rand() [18/24]

template<>
long long rand ( long long hi)
inherited
Parameters
hiUpper or lower bound of random number.
Returns
A long long between 0 and hi, regardless of the sign of hi.

◆ rand() [19/24]

template<>
long long rand ( long long lo,
long long hi )
inherited
Parameters
loLower bound of random number.
hiUpper bound of random number.
Returns
A long long between lo and hi.

◆ rand() [20/24]

template<typename T>
T rand ( T lo,
T hi )
inlineinherited

Produces a (pseudo-) random T with uniform distribution between lo and hi.

Parameters
loLower bound for possible T samples.
hiUpper bound for possible T samples.

◆ rand() [21/24]

template<typename T>
T rand ( T max)
inlineinherited

Produces a (pseudo-) random T with uniform distribution between the T analogue of 0 and max.

Parameters
maxUpper bound of possible T samples.

◆ rand() [22/24]

template<>
unsigned int rand ( unsigned int hi)
inherited
Parameters
hiUpper bound of random number.
Returns
An unsigned int between 0 and hi.

◆ rand() [23/24]

template<>
unsigned long rand ( unsigned long hi)
inherited
Parameters
hiUpper bound of random number.
Returns
An unsigned long between 0 and hi.

◆ rand() [24/24]

template<>
unsigned long long rand ( unsigned long long hi)
inherited
Parameters
hiUpper bound of random number.
Returns
An unsigned long long between 0 and hi.

◆ rand32()

uint32_t rand32 ( )
inlinevirtual
Returns
No fewer than 32 (pseudo-) random bits.

Implements Random.

◆ rseed()

void rseed ( uint64_t seed)
inlinevirtual

Reset the generator's state with the bits of seed as its source of entropy.

Implements Random.


The documentation for this class was generated from the following file: