Lattice Microbes 2.5
This is for whole cell modeling
Loading...
Searching...
No Matches
lm::rng::XORShift Class Reference

A random number generator that works for a grid based on the index. More...

#include <XORShift.h>

Inheritance diagram for lm::rng::XORShift:
[legend]
Collaboration diagram for lm::rng::XORShift:
[legend]

Public Member Functions

 XORShift (uint32_t seedTop, uint32_t seedBottom)
 Create the XORShift random number generator.
virtual ~XORShift ()
 Destory the XORShift object.
virtual uint32_t getRandom ()
 Get a random integer.
virtual double getRandomDouble ()
 Get a random double.
virtual double getExpRandomDouble ()
 Get a random exponentially distributed double.
virtual double getNormRandomDouble ()
 Get a random normally distributed double.
virtual void getRandomDoubles (double *rngs, int numberRNGs)
 Get a set of random doubles.
virtual void getExpRandomDoubles (double *rngs, int numberRNGs)
 Get a set of random exponentially distributed doubles.
virtual void getNormRandomDoubles (double *rngs, int numberRNGs)
 Get a set of random normally distributed doubles.
Public Member Functions inherited from lm::rng::RandomGenerator
 RandomGenerator (uint32_t seedTop, uint32_t seedBottom, Distributions availableDists=(Distributions)(ALL))
virtual ~RandomGenerator ()
virtual uint64_t getSeed ()
 Get the current seed.

Protected Attributes

unsigned long long state
bool isNextGaussianValid
double nextGaussian
Protected Attributes inherited from lm::rng::RandomGenerator
uint64_t seed
Distributions availableDists

Additional Inherited Members

Public Types inherited from lm::rng::RandomGenerator
enum  Distributions {
  NONE = 0x00 , UNIFORM = 0x01 , EXPONENTIAL = 0x02 , NORMAL = 0x04 ,
  ALL = 0xFF
}
 Types of random number generators that are allowed. More...

Detailed Description

A random number generator that works for a grid based on the index.

Constructor & Destructor Documentation

◆ XORShift()

lm::rng::XORShift::XORShift ( uint32_t seedTop,
uint32_t seedBottom )

Create the XORShift random number generator.

Parameters
seedTopTop 32 bits of the random seed
seedBottomBottom 32 bits of the random seed
Here is the call graph for this function:

◆ ~XORShift()

virtual lm::rng::XORShift::~XORShift ( )
inlinevirtual

Destory the XORShift object.

Member Function Documentation

◆ getExpRandomDouble()

double lm::rng::XORShift::getExpRandomDouble ( )
virtual

Get a random exponentially distributed double.

Returns
random A random double

Returns an exponentially distributed value.

Implements lm::rng::RandomGenerator.

Here is the call graph for this function:

◆ getExpRandomDoubles()

void lm::rng::XORShift::getExpRandomDoubles ( double * rngs,
int numberRNGs )
virtual

Get a set of random exponentially distributed doubles.

Parameters
rngsPointer to memory for random numbers
numberRNGsThe size of the rngs variable

Reimplemented from lm::rng::RandomGenerator.

Here is the call graph for this function:

◆ getNormRandomDouble()

double lm::rng::XORShift::getNormRandomDouble ( )
virtual

Get a random normally distributed double.

Returns
random A random double

Returns an normally distributed value.

Implements lm::rng::RandomGenerator.

Here is the call graph for this function:

◆ getNormRandomDoubles()

void lm::rng::XORShift::getNormRandomDoubles ( double * rngs,
int numberRNGs )
virtual

Get a set of random normally distributed doubles.

Parameters
rngsPointer to memory for random numbers
numberRNGsThe size of the rngs variable

Reimplemented from lm::rng::RandomGenerator.

Here is the call graph for this function:

◆ getRandom()

uint32_t lm::rng::XORShift::getRandom ( )
virtual

Get a random integer.

Returns
random A random integer

Implements lm::rng::RandomGenerator.

Here is the caller graph for this function:

◆ getRandomDouble()

double lm::rng::XORShift::getRandomDouble ( )
virtual

Get a random double.

Returns
random A random double

Returns a float value in the range [0.0 1.0).

Implements lm::rng::RandomGenerator.

Here is the call graph for this function:

◆ getRandomDoubles()

void lm::rng::XORShift::getRandomDoubles ( double * rngs,
int numberRNGs )
virtual

Get a set of random doubles.

Parameters
rngsPointer to memory for random numbers
numberRNGsThe size of the rngs variable

Reimplemented from lm::rng::RandomGenerator.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ isNextGaussianValid

bool lm::rng::XORShift::isNextGaussianValid
protected

◆ nextGaussian

double lm::rng::XORShift::nextGaussian
protected

◆ state

unsigned long long lm::rng::XORShift::state
protected

The documentation for this class was generated from the following files:
  • /data2/LM_zls_github/Lattice-Microbes/src/rng/XORShift.h
  • /data2/LM_zls_github/Lattice-Microbes/src/rng/XORShift.cpp