Mantid
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
Mantid::Kernel::PseudoRandomNumberGenerator Class Referenceabstract

Defines a 1D pseudo-random number generator, i.e. More...

#include <PseudoRandomNumberGenerator.h>

Inheritance diagram for Mantid::Kernel::PseudoRandomNumberGenerator:
Mantid::Kernel::NDRandomNumberGenerator Mantid::Kernel::MersenneTwister

Public Types

using result_type = double
 Result (output) value type. More...
 

Public Member Functions

void generateNextPoint () override
 Generates the next point. More...
 
virtual double max () const =0
 Return the maximum value of the range. More...
 
virtual double min () const =0
 Return the minimum value of the range. More...
 
virtual int nextInt (int start, int end)=0
 Return the next integer in the sequence. More...
 
virtual double nextValue ()=0
 Return the next double in the sequence. More...
 
virtual double nextValue (double start, double end)=0
 Return the next double in the sequence overriding the default range. More...
 
double operator() ()
 Return next random value. More...
 
PseudoRandomNumberGeneratoroperator= (const PseudoRandomNumberGenerator &)=delete
 Disable assignment operator. More...
 
 PseudoRandomNumberGenerator ()
 Default constructor setting the dimension to 1. More...
 
 PseudoRandomNumberGenerator (const PseudoRandomNumberGenerator &)=delete
 Disable copy operator. More...
 
virtual void setRange (const double start, const double end)=0
 Sets the range of the subsequent calls to nextValue;. More...
 
virtual void setSeed (const size_t seedValue)=0
 Set the random number seed. More...
 
- Public Member Functions inherited from Mantid::Kernel::NDRandomNumberGenerator
 NDRandomNumberGenerator ()=delete
 Disable default constructor. More...
 
 NDRandomNumberGenerator (const NDRandomNumberGenerator &)=delete
 Disable copy operator. More...
 
 NDRandomNumberGenerator (const unsigned int ndims)
 Constructor. More...
 
const std::vector< double > & nextPoint ()
 Generate the next set of values that form a point in ND space. More...
 
unsigned int numberOfDimensions () const
 Returns the number of dimensions the point will be generated in, i.e. More...
 
NDRandomNumberGeneratoroperator= (const NDRandomNumberGenerator &)=delete
 Disable assignment operator. More...
 
virtual void restart ()=0
 Restarts the generator from the beginning of the sequence. More...
 
virtual void restore ()=0
 Restores the generator to the last saved point, or the beginning if nothing has been saved. More...
 
virtual void save ()=0
 Saves the current state of the generator. More...
 
virtual ~NDRandomNumberGenerator ()=default
 Virtual destructor to ensure that all inheriting classes have one. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Mantid::Kernel::NDRandomNumberGenerator
void cacheGeneratedValue (const size_t index, const double value)
 Cache a value for a given dimension index, i.e. 0->ND-1. More...
 
void cacheNextPoint (const std::vector< double > &nextPoint)
 Cache the while point in one go. More...
 
virtual void generateNextPoint ()=0
 Generate the next point. Override this in you concrete implementation. More...
 
std::vector< double > & getNextPointCache ()
 Some generators need direct access to the cache. More...
 

Detailed Description

Defines a 1D pseudo-random number generator, i.e.

a generator that takes an initial seed and produces a set of numbers. It specialises the interface for a general random number generator.

Definition at line 22 of file PseudoRandomNumberGenerator.h.

Member Typedef Documentation

◆ result_type

Result (output) value type.

Definition at line 47 of file PseudoRandomNumberGenerator.h.

Constructor & Destructor Documentation

◆ PseudoRandomNumberGenerator() [1/2]

Mantid::Kernel::PseudoRandomNumberGenerator::PseudoRandomNumberGenerator ( )

Default constructor setting the dimension to 1.

Definition at line 15 of file PseudoRandomNumberGenerator.cpp.

◆ PseudoRandomNumberGenerator() [2/2]

Mantid::Kernel::PseudoRandomNumberGenerator::PseudoRandomNumberGenerator ( const PseudoRandomNumberGenerator )
delete

Disable copy operator.

Member Function Documentation

◆ generateNextPoint()

void Mantid::Kernel::PseudoRandomNumberGenerator::generateNextPoint ( )
overridevirtual

Generates the next point.

Returns the next value in the 1D sequence as a point to be compatible with the NDRandomNumberGenerator interface.

Implements Mantid::Kernel::NDRandomNumberGenerator.

Definition at line 21 of file PseudoRandomNumberGenerator.cpp.

References Mantid::Kernel::NDRandomNumberGenerator::cacheGeneratedValue(), and nextValue().

◆ max()

virtual double Mantid::Kernel::PseudoRandomNumberGenerator::max ( ) const
pure virtual

Return the maximum value of the range.

Implemented in Mantid::Kernel::MersenneTwister.

◆ min()

virtual double Mantid::Kernel::PseudoRandomNumberGenerator::min ( ) const
pure virtual

Return the minimum value of the range.

Implemented in Mantid::Kernel::MersenneTwister.

◆ nextInt()

virtual int Mantid::Kernel::PseudoRandomNumberGenerator::nextInt ( int  start,
int  end 
)
pure virtual

Return the next integer in the sequence.

Implemented in Mantid::Kernel::MersenneTwister.

Referenced by Mantid::Algorithms::MCInteractionVolume::getComponentIndex().

◆ nextValue() [1/2]

virtual double Mantid::Kernel::PseudoRandomNumberGenerator::nextValue ( )
pure virtual

◆ nextValue() [2/2]

virtual double Mantid::Kernel::PseudoRandomNumberGenerator::nextValue ( double  start,
double  end 
)
pure virtual

Return the next double in the sequence overriding the default range.

Implemented in Mantid::Kernel::MersenneTwister.

◆ operator()()

double Mantid::Kernel::PseudoRandomNumberGenerator::operator() ( )
inline

Return next random value.

Definition at line 53 of file PseudoRandomNumberGenerator.h.

◆ operator=()

PseudoRandomNumberGenerator & Mantid::Kernel::PseudoRandomNumberGenerator::operator= ( const PseudoRandomNumberGenerator )
delete

Disable assignment operator.

◆ setRange()

virtual void Mantid::Kernel::PseudoRandomNumberGenerator::setRange ( const double  start,
const double  end 
)
pure virtual

Sets the range of the subsequent calls to nextValue;.

Implemented in Mantid::Kernel::MersenneTwister.

◆ setSeed()

virtual void Mantid::Kernel::PseudoRandomNumberGenerator::setSeed ( const size_t  seedValue)
pure virtual

Set the random number seed.

Implemented in Mantid::Kernel::MersenneTwister.


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