Mantid
Loading...
Searching...
No Matches
PseudoRandomNumberGenerator.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2012 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9//------------------------------------------------------------------------------
10// Includes
11//------------------------------------------------------------------------------
13
14namespace Mantid {
15namespace Kernel {
22class MANTID_KERNEL_DLL PseudoRandomNumberGenerator : public NDRandomNumberGenerator {
23public:
26
29
32
34 virtual void setSeed(const size_t seedValue) = 0;
36 virtual void setRange(const double start, const double end) = 0;
38 virtual double nextValue() = 0;
40 virtual double nextValue(double start, double end) = 0;
42 virtual int nextInt(int start, int end) = 0;
44 void generateNextPoint() override;
45 // Interface to boost distribution generators
47 using result_type = double;
49 virtual double min() const = 0;
51 virtual double max() const = 0;
53 double operator()() { return nextValue(); }
54};
55} // namespace Kernel
56} // namespace Mantid
This class defines an interface for N dimensional random number generators.
Defines a 1D pseudo-random number generator, i.e.
PseudoRandomNumberGenerator(const PseudoRandomNumberGenerator &)=delete
Disable copy operator.
virtual void setSeed(const size_t seedValue)=0
Set the random number seed.
virtual double min() const =0
Return the minimum value of the range.
PseudoRandomNumberGenerator & operator=(const PseudoRandomNumberGenerator &)=delete
Disable assignment operator.
virtual double nextValue(double start, double end)=0
Return the next double in the sequence overriding the default range.
virtual double max() const =0
Return the maximum value of the range.
virtual double nextValue()=0
Return the next double in the sequence.
virtual void setRange(const double start, const double end)=0
Sets the range of the subsequent calls to nextValue;.
virtual int nextInt(int start, int end)=0
Return the next integer in the sequence.
Helper class which provides the Collimation Length for SANS instruments.