lin
Public Member Functions | Private Attributes | List of all members
lin::internal::RandomsGenerator Class Reference

Random number generator. More...

#include <lin/generators/randoms.hpp>

Public Member Functions

constexpr RandomsGenerator (RandomsGenerator const &)=default
 
constexpr RandomsGenerator (RandomsGenerator &&)=default
 
constexpr RandomsGeneratoroperator= (RandomsGenerator const &)=default
 
constexpr RandomsGeneratoroperator= (RandomsGenerator &&)=default
 
constexpr RandomsGenerator (unsigned long long seed=0)
 Creates a random number generator based on the specified seed. More...
 
constexpr double rand ()
 Generates a uniform random number in the range zero to one. More...
 
constexpr double gaussian ()
 Return a gaussian random number with mean 0 and std 1. Uses Box-Mueller transform with caching. More...
 

Private Attributes

unsigned long long seed
 Seed for the random number generator.
 
double cached_rand
 Value of a cached standard normal gassauisan random.
 
bool has_cached
 has_cached is true if there's a cached standard normal available.
 

Detailed Description

Random number generator.

Produces random values in the range zero to one. It's used by the rands generator function.

Constructor & Destructor Documentation

constexpr lin::internal::RandomsGenerator::RandomsGenerator ( unsigned long long  seed = 0)
inline

Creates a random number generator based on the specified seed.

Parameters
[in]seed

Member Function Documentation

constexpr double lin::internal::RandomsGenerator::rand ( )
inline

Generates a uniform random number in the range zero to one.

Returns
Random number between zero and one.
constexpr double lin::internal::RandomsGenerator::gaussian ( )
inline

Return a gaussian random number with mean 0 and std 1. Uses Box-Mueller transform with caching.

Returns
constexpr double

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