restartableRandomGenerator Class Reference

Random number generator with the additional ability to go back to an earlier stored state. Useful for processes that occur within converging iteration loops to ensure that the random sequence is the same for each iteration, and is not preventing convergence by "re-randomising" the solution on each iteration. More...

Inheritance diagram for restartableRandomGenerator:
Collaboration diagram for restartableRandomGenerator:

Public Member Functions

template<class ... Args>
 restartableRandomGenerator (Args &&... args)
 Forward all constructors. More...
 
void start (const bool repeat)
 Start a sequence of random numbers. Either a new sequence, or a. More...
 
- Public Member Functions inherited from randomGenerator
 randomGenerator (const seed s, const bool global=false)
 Construct from a seed. More...
 
 randomGenerator (const randomGenerator &)
 Copy construct. More...
 
 randomGenerator (randomGenerator &&)
 Move construct. More...
 
 randomGenerator (Istream &is, const bool global=false)
 Construct from a stream. More...
 
 randomGenerator (const word &name, const dictionary &dict, randomGenerator &&defaultRndGen)
 Construct from a dictionary. More...
 
 randomGenerator (const word &name, const dictionary &dict, const seed defaultS, const bool global=false)
 Construct from a dictionary. More...
 
 ~randomGenerator ()
 Destructor. More...
 
scalar scalar01 ()
 Return a scalar uniformly distributed between zero and one. More...
 
tmp< scalarFieldscalar01 (const label n)
 Return scalars uniformly distributed between zero and one. More...
 
scalar scalarAB (const scalar a, const scalar b)
 Return a scalar uniformly distributed between two limits. More...
 
tmp< scalarFieldscalarAB (const label n, const scalar a, const scalar b)
 Return scalars uniformly distributed between two limits. More...
 
template<class Type >
Type sample01 ()
 Return a type with components uniformly distributed between. More...
 
template<class Type >
tmp< Field< Type > > sample01 (const label n)
 Return types with components uniformly distributed between zero. More...
 
template<class Type >
Type sampleAB (const Type &a, const Type &b)
 Return a type with components uniformly distributed between two. More...
 
template<class Type >
tmp< Field< Type > > sampleAB (const label n, const Type &a, const Type &b)
 Return types with components uniformly distributed between two. More...
 
template<class Container >
void permute (Container &l)
 Randomly permute a list. More...
 
randomGenerator generator ()
 Create a randomly seeded generator. More...
 
void operator= (const randomGenerator &)
 Copy-assignment. More...
 
void operator= (randomGenerator &&)
 Move-assignment. More...
 
template<>
scalar sample01NoCheckSync ()
 
template<>
scalar sampleABNoCheckSync (const scalar &a, const scalar &b)
 
template<>
label sampleABNoCheckSync (const label &a, const label &b)
 
template<class Type >
Foam::tmp< Foam::Field< Type > > sample01 (const label n)
 
template<class Type >
Foam::tmp< Foam::Field< Type > > sampleAB (const label n, const Type &a, const Type &b)
 

Detailed Description

Random number generator with the additional ability to go back to an earlier stored state. Useful for processes that occur within converging iteration loops to ensure that the random sequence is the same for each iteration, and is not preventing convergence by "re-randomising" the solution on each iteration.

Definition at line 49 of file restartableRandomGenerator.H.

Constructor & Destructor Documentation

◆ restartableRandomGenerator()

restartableRandomGenerator ( Args &&...  args)
inline

Forward all constructors.

Definition at line 65 of file restartableRandomGenerator.H.

Member Function Documentation

◆ start()

void start ( const bool  repeat)
inline

Start a sequence of random numbers. Either a new sequence, or a.

repeat of the previous, as indicated by the provided flag.

Definition at line 76 of file restartableRandomGenerator.H.


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