Classes | Public Member Functions | Static Public Attributes | List of all members
Random Class Reference

Random number generator. More...

Classes

class  gaussianGeneratorOp
 
class  uniformGeneratorOp
 

Public Member Functions

 Random (const label seedValue=defaultSeed)
 
 Random (const Random &rnd, const bool reset)
 
label seed () const
 
void reset (const label seedValue)
 
int bit ()
 
template<class Type >
Type sample01 ()
 
template<class Type >
Type GaussNormal ()
 
template<class Type >
Type position (const Type &start, const Type &end)
 
template<class Type >
void randomise01 (Type &value)
 
template<class Type >
void shuffle (UList< Type > &values)
 
template<class Type >
Type globalSample01 ()
 
template<class Type >
Type globalGaussNormal ()
 
template<class Type >
Type globalPosition (const Type &start, const Type &end)
 
template<class Type >
void globalRandomise01 (Type &value)
 
template<>
Foam::scalar sample01 ()
 
template<>
Foam::scalar 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::scalar 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)
 

Static Public Attributes

static constexpr label defaultSeed = 123456
 

Detailed Description

Random number generator.

Source files

Definition at line 55 of file Random.H.

Constructor & Destructor Documentation

◆ Random() [1/2]

Random ( const label  seedValue = defaultSeed)
explicit

Definition at line 26 of file Random.C.

◆ Random() [2/2]

Random ( const Random rnd,
const bool  reset 
)

Definition at line 36 of file Random.C.

References Random::reset(), and Rand48::seed().

Here is the call graph for this function:

Member Function Documentation

◆ seed()

Foam::label seed ( ) const
inline

Definition at line 37 of file RandomI.H.

◆ reset()

void reset ( const label  seedValue)
inline

Definition at line 43 of file RandomI.H.

Referenced by Random::Random().

Here is the caller graph for this function:

◆ bit()

int bit ( )
inline

Definition at line 31 of file RandomI.H.

◆ sample01() [1/4]

Type sample01

◆ GaussNormal() [1/4]

Type GaussNormal

◆ position() [1/5]

Type position ( const Type &  start,
const Type &  end 
)

◆ randomise01()

void randomise01 ( Type &  value)

Definition at line 69 of file RandomTemplates.C.

◆ shuffle()

void shuffle ( UList< Type > &  values)

Definition at line 76 of file RandomTemplates.C.

References Foam::Swap(), and Foam::HashTableOps::values().

Referenced by eddy::eddy(), and ConeInjection< CloudType >::setPositionAndCell().

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

◆ globalSample01() [1/4]

Type globalSample01

Definition at line 87 of file RandomTemplates.C.

References UPstream::master(), and Pstream::scatter().

Referenced by patchInjectionBase::setPositionAndCell().

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

◆ globalGaussNormal() [1/4]

Type globalGaussNormal

Definition at line 103 of file RandomTemplates.C.

References UPstream::master(), and Pstream::scatter().

Here is the call graph for this function:

◆ globalPosition() [1/5]

Type globalPosition ( const Type &  start,
const Type &  end 
)

◆ globalRandomise01()

void globalRandomise01 ( Type &  value)

Definition at line 135 of file RandomTemplates.C.

References UPstream::master(), and Pstream::scatter().

Here is the call graph for this function:

◆ sample01() [2/4]

Foam::label sample01 ( )

Definition at line 52 of file Random.C.

◆ GaussNormal() [2/4]

Foam::label GaussNormal ( )

Definition at line 66 of file Random.C.

References Foam::log(), Foam::sqr(), and Foam::sqrt().

Here is the call graph for this function:

◆ position() [2/5]

Foam::scalar position ( const scalar &  start,
const scalar &  end 
)

Definition at line 103 of file Random.C.

References stdFoam::end().

Here is the call graph for this function:

◆ position() [3/5]

Foam::label position ( const label &  start,
const label &  end 
)

Definition at line 113 of file Random.C.

References Foam::abort(), stdFoam::end(), Foam::FatalError, FatalErrorInFunction, Foam::min(), and Foam::nl.

Here is the call graph for this function:

◆ globalSample01() [2/4]

Foam::label globalSample01 ( )

Definition at line 137 of file Random.C.

References UPstream::master(), and Pstream::scatter().

Here is the call graph for this function:

◆ globalGaussNormal() [2/4]

Foam::label globalGaussNormal ( )

Definition at line 169 of file Random.C.

References UPstream::master(), and Pstream::scatter().

Here is the call graph for this function:

◆ globalPosition() [2/5]

Foam::scalar globalPosition ( const scalar &  start,
const scalar &  end 
)

Definition at line 202 of file Random.C.

References stdFoam::end(), UPstream::master(), and Pstream::scatter().

Here is the call graph for this function:

◆ globalPosition() [3/5]

Foam::label globalPosition ( const label &  start,
const label &  end 
)

Definition at line 222 of file Random.C.

References stdFoam::end(), Foam::labelMin, UPstream::master(), and Pstream::scatter().

Here is the call graph for this function:

◆ sample01() [3/4]

scalar sample01 ( )

◆ sample01() [4/4]

label sample01 ( )

◆ GaussNormal() [3/4]

scalar GaussNormal ( )

◆ GaussNormal() [4/4]

label GaussNormal ( )

◆ position() [4/5]

scalar position ( const scalar &  start,
const scalar &  end 
)

◆ position() [5/5]

label position ( const label &  start,
const label &  end 
)

◆ globalSample01() [3/4]

scalar globalSample01 ( )

◆ globalSample01() [4/4]

label globalSample01 ( )

◆ globalGaussNormal() [3/4]

scalar globalGaussNormal ( )

◆ globalGaussNormal() [4/4]

label globalGaussNormal ( )

◆ globalPosition() [4/5]

scalar globalPosition ( const scalar &  start,
const scalar &  end 
)

◆ globalPosition() [5/5]

label globalPosition ( const label &  start,
const label &  end 
)

Member Data Documentation

◆ defaultSeed

constexpr label defaultSeed = 123456
staticconstexpr

Definition at line 91 of file Random.H.


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