Skip to content

Class TempLat::RandomUniform

template <typename T, typename RNG>

ClassList > TempLat > RandomUniform

A class which gives pseudo random counter-based rng, based on a string random seed, stable across platforms. More...

  • #include <randomuniform.h>

Public Types

Type Name
typedef INT IntegerType

Public Functions

Type Name
RandomUniform (const std::string & stringSeed)
DEVICE_INLINE_FUNCTION T get (INT r, INT c, INT gen) const
DEVICE_INLINE_FUNCTION device::array< T, 2 > getPair (INT r, INT c, INT gen) const
auto getSeed () const
const std::string & getSeedString () const
DEVICE_INLINE_FUNCTION T integer_to_float (R value) const
void loadState (const std::string & state)
Restores RNG state from a serialized string.
std::string saveState () const
Serializes the complete RNG state to a string.

Detailed Description

Unit test: ctest -R test-randomuniform

Public Types Documentation

typedef IntegerType

using TempLat::RandomUniform< T, RNG >::IntegerType =  INT;

Public Functions Documentation

function RandomUniform

inline TempLat::RandomUniform::RandomUniform (
    const std::string & stringSeed
) 

function get

inline DEVICE_INLINE_FUNCTION T TempLat::RandomUniform::get (
    INT r,
    INT c,
    INT gen
) const

function getPair

inline DEVICE_INLINE_FUNCTION device::array< T, 2 > TempLat::RandomUniform::getPair (
    INT r,
    INT c,
    INT gen
) const

function getSeed

inline auto TempLat::RandomUniform::getSeed () const

function getSeedString

inline const std::string & TempLat::RandomUniform::getSeedString () const

function integer_to_float

template<typename R>
inline DEVICE_INLINE_FUNCTION T TempLat::RandomUniform::integer_to_float (
    R value
) const

function loadState

Restores RNG state from a serialized string.

inline void TempLat::RandomUniform::loadState (
    const std::string & state
) 

Parameters:


function saveState

Serializes the complete RNG state to a string.

inline std::string TempLat::RandomUniform::saveState () const

Returns:

String containing serialized mt19937_64 state and counter


Friends Documentation

friend operator<<

inline std::ostream & TempLat::RandomUniform::operator<< (
    std::ostream & ostream,
    const RandomUniform & pr
) 

friend operator==

For testing purposes, we need to compare prng's, specifically their seeds.

inline bool TempLat::RandomUniform::operator== (
    const RandomUniform & a,
    const RandomUniform & b
) 



The documentation for this class was generated from the following file cosmolatticeweb/tmp/code_source/templat/include/TempLat/util/random/randomuniform.h