Mantid
|
Defines a 1D pseudo-random number generator, i.e. More...
#include <PseudoRandomNumberGenerator.h>
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... | |
PseudoRandomNumberGenerator & | operator= (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... | |
NDRandomNumberGenerator & | operator= (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... | |
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.
using Mantid::Kernel::PseudoRandomNumberGenerator::result_type = double |
Result (output) value type.
Definition at line 47 of file PseudoRandomNumberGenerator.h.
Mantid::Kernel::PseudoRandomNumberGenerator::PseudoRandomNumberGenerator | ( | ) |
Default constructor setting the dimension to 1.
Definition at line 15 of file PseudoRandomNumberGenerator.cpp.
|
delete |
Disable copy operator.
|
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().
|
pure virtual |
Return the maximum value of the range.
Implemented in Mantid::Kernel::MersenneTwister.
|
pure virtual |
Return the minimum value of the range.
Implemented in Mantid::Kernel::MersenneTwister.
|
pure virtual |
Return the next integer in the sequence.
Implemented in Mantid::Kernel::MersenneTwister.
Referenced by Mantid::Algorithms::MCInteractionVolume::getComponentIndex().
|
pure virtual |
Return the next double in the sequence.
Implemented in Mantid::Kernel::MersenneTwister.
Referenced by Mantid::Geometry::RandomPoint::bounded(), generateNextPoint(), Mantid::Algorithms::CircularBeamProfile::generatePoint(), Mantid::Algorithms::RectangularBeamProfile::generatePoint(), Mantid::Geometry::RandomPoint::inCuboid(), Mantid::Geometry::RandomPoint::inCylinder(), Mantid::Geometry::RandomPoint::inHollowCylinder(), Mantid::Geometry::RandomPoint::inSphere(), Mantid::Algorithms::DiscusMultipleScatteringCorrection::q_dir(), Mantid::Algorithms::DiscusMultipleScatteringCorrection::sampleQWUniform(), and Mantid::Algorithms::DiscusMultipleScatteringCorrection::updateWeightAndPosition().
|
pure virtual |
Return the next double in the sequence overriding the default range.
Implemented in Mantid::Kernel::MersenneTwister.
|
inline |
Return next random value.
Definition at line 53 of file PseudoRandomNumberGenerator.h.
|
delete |
Disable assignment operator.
|
pure virtual |
Sets the range of the subsequent calls to nextValue;.
Implemented in Mantid::Kernel::MersenneTwister.
|
pure virtual |
Set the random number seed.
Implemented in Mantid::Kernel::MersenneTwister.