Random::uniformGeneratorOp< T > Class Template Reference

A generator class returning a uniformly distributed random number on the given interval. More...

Inheritance diagram for Random::uniformGeneratorOp< T >:
Collaboration diagram for Random::uniformGeneratorOp< T >:

Public Member Functions

 uniformGeneratorOp (const label seed=Random::defaultSeed)
 Default construct or with seed value. Uses default [0,1] interval. More...
 
 uniformGeneratorOp (const T &minval, const T &maxval)
 Construct with specified interval, using default seed. More...
 
 uniformGeneratorOp (const label seed, const T &minval, const T &maxval)
 Construct with seed value and specified interval. More...
 
T operator() ()
 Generate a random number. More...
 
template<class U >
T operator() (const U &) const
 Ignore parameter and generate a random number, which allows it to be used as a replacement for general unary operators. More...
 
- Public Member Functions inherited from Random
 Random (const label seedValue=defaultSeed)
 Construct with seed value. More...
 
 Random (const Random &rnd, const bool reset)
 Copy construct with possible reset of seed. More...
 
label seed () const
 The initial random number seed that was used. More...
 
void reset (const label seedValue)
 Reset the random number generator seed. More...
 
int bit ()
 Return a random bit. More...
 
template<class Type >
Type sample01 ()
 Return a sample whose components lie in the range [0,1]. More...
 
template<class Type >
Type GaussNormal ()
 Return a sample whose components are normally distributed with zero mean and unity variance N(0,1) More...
 
template<class Type >
Type position (const Type &start, const Type &end)
 Return a sample on the interval [start,end]. More...
 
template<class Type >
void randomise01 (Type &value)
 Randomise value in the range [0,1]. More...
 
template<class Type >
void shuffle (UList< Type > &values)
 Shuffle the values in the list. More...
 
template<class Type >
Type globalSample01 ()
 Return a sample whose components lie in the range [0,1]. More...
 
template<class Type >
Type globalGaussNormal ()
 Return a sample whose components are normally distributed with zero mean and unity variance N(0,1) More...
 
template<class Type >
Type globalPosition (const Type &start, const Type &end)
 Return a sample on the interval [start,end]. More...
 
template<class Type >
void globalRandomise01 (Type &value)
 Randomise value in the range 0-1. More...
 
template<>
Foam::scalar sample01 ()
 
template<>
Foam::label sample01 ()
 
template<>
Foam::scalar GaussNormal ()
 
template<>
Foam::label GaussNormal ()
 
template<>
Foam::scalar position (const scalar &start, const scalar &end)
 
template<>
Foam::label position (const label &start, const label &end)
 
template<>
Foam::scalar globalSample01 ()
 
template<>
Foam::label globalSample01 ()
 
template<>
Foam::scalar globalGaussNormal ()
 
template<>
Foam::label globalGaussNormal ()
 
template<>
Foam::scalar globalPosition (const scalar &start, const scalar &end)
 
template<>
Foam::label globalPosition (const label &start, const label &end)
 
template<>
scalar sample01 ()
 
template<>
label sample01 ()
 
template<>
scalar GaussNormal ()
 
template<>
label GaussNormal ()
 
template<>
scalar position (const scalar &start, const scalar &end)
 
template<>
label position (const label &start, const label &end)
 
template<>
scalar globalSample01 ()
 
template<>
label globalSample01 ()
 
template<>
scalar globalGaussNormal ()
 
template<>
label globalGaussNormal ()
 
template<>
scalar globalPosition (const scalar &start, const scalar &end)
 
template<>
label globalPosition (const label &start, const label &end)
 

Additional Inherited Members

- Static Public Attributes inherited from Random
static constexpr label defaultSeed = 123456
 The default seed value (name may change in the future) More...
 

Detailed Description

template<class T>
class Foam::Random::uniformGeneratorOp< T >

A generator class returning a uniformly distributed random number on the given interval.

See also
std::generate()

Definition at line 96 of file Random.H.

Constructor & Destructor Documentation

◆ uniformGeneratorOp() [1/3]

uniformGeneratorOp ( const label  seed = Random::defaultSeed)
inlineexplicit

Default construct or with seed value. Uses default [0,1] interval.

Definition at line 288 of file Random.H.

◆ uniformGeneratorOp() [2/3]

uniformGeneratorOp ( const T minval,
const T maxval 
)
inline

Construct with specified interval, using default seed.

Definition at line 296 of file Random.H.

◆ uniformGeneratorOp() [3/3]

uniformGeneratorOp ( const label  seed,
const T minval,
const T maxval 
)
inline

Construct with seed value and specified interval.

Definition at line 304 of file Random.H.

Member Function Documentation

◆ operator()() [1/2]

T operator() ( )
inline

Generate a random number.

Definition at line 317 of file Random.H.

◆ operator()() [2/2]

T operator() ( const U ) const
inline

Ignore parameter and generate a random number, which allows it to be used as a replacement for general unary operators.

Definition at line 327 of file Random.H.


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