STORMM Source Documentation
Loading...
Searching...
No Matches
stormm::stmath::Ran2Generator Class Reference

Stores the state of a Ran2 pseudo-random number generator. Member functions produce random numbers along various distributions, as required. While it is not as performant to have a member function, these random number generators are intended for convenience and unit testing purposes. Developers that wish to use higher-performance random number generators should use the Xoroshiro128Generator (below) or link other libraries for the C++ layer (i.e. Intel MKL) or libraries that run on the GPU layer (i.e. cuRAND). More...

#include <random.h>

Public Member Functions

 Ran2Generator (int igseed=default_random_seed)
 Initialize the unit testing on-board pseudo-random number generator.
 
double uniformRandomNumber ()
 Return a single random number distributed over a uniform distribution [0, 1). This is an internal generator based on an integer vector state which will provide reproducible results across platforms.
 
float spUniformRandomNumber ()
 Return a single random number distributed over a uniform distribution [0, 1), in single-precision. While the XOR-shift random generators have a distinct method for producing single-precision random numbers (selecting the highest-quality bits), this merely calls uniformRandomNumber() and exists for compatibility with the other generators in templated xxxxRand() functions.
 
double gaussianRandomNumber ()
 Return a normally distributed random number with standard deviation 1.0. This works off of the uniform random number generator and will thus advance the state vector of the random number generator that produces the result.
 
float spGaussianRandomNumber ()
 Produce a single-precision random number on the normal distribution with a standard deviation of 1.0. Like spUniformRandomNumber(), this function merely calls gaussianRandomNumber() and exists for compatibility with other random number generators in templated functions.
 

Detailed Description

Stores the state of a Ran2 pseudo-random number generator. Member functions produce random numbers along various distributions, as required. While it is not as performant to have a member function, these random number generators are intended for convenience and unit testing purposes. Developers that wish to use higher-performance random number generators should use the Xoroshiro128Generator (below) or link other libraries for the C++ layer (i.e. Intel MKL) or libraries that run on the GPU layer (i.e. cuRAND).

Constructor & Destructor Documentation

◆ Ran2Generator()

stormm::random::Ran2Generator::Ran2Generator ( int igseed = default_random_seed)

Initialize the unit testing on-board pseudo-random number generator.

Parameters
igseedThe pseudo-randome number seed

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