#include <random.hpp>
Definition at line 19 of file random.hpp.
Public Member Functions | |
Random () | |
Default constructor. | |
Random (const Random &other) | |
Copy constructor. | |
~Random () | |
Destructor. | |
double | uniform () |
Returns a pseudorandom real number in the range ![]() | |
double | uniform (double a, double b) |
Returns a pseudorandom real number in the range ![]() | |
unsigned long int | uniform (unsigned long int n) |
Returns a pseudorandom integer in the range ![]() | |
bool | bernoulli (double p=0.5) |
Returns true with probability ![]() ![]() | |
unsigned int | binomial (double p, unsigned int n) |
Returns a sample from the binomial distribution with success probability ![]() ![]() | |
Geometry::Point | uniform (const Geometry::Point &source, const Geometry::Point &target) |
Samples a point uniformly from a line segment. | |
Geometry::Point | uniform (const Geometry::Segment &s) |
Samples a point uniformly from a line segment. | |
Geometry::Point | uniform (const Geometry::Triangle &t) |
Samples a point uniformly from a triangle. | |
void | write (std::ostream &out) const |
Writes a short description of this PRNG to the supplied stream. | |
Protected Attributes | |
gsl_rng * | r |
The underlying pseudorandom number generator. |
|
Default constructor. If the environment variables GSL_RNG_TYPE and/or GSL_RNG_SEED are specified, then their values are used to determine the type and initial state of the pseudorandom number generator. The defaults are to use the Mersenne Twister PRNG with the seed 0. Definition at line 37 of file random.hpp. |
|
Copy constructor.
Definition at line 49 of file random.hpp. |
|
Destructor.
Definition at line 54 of file random.hpp. |
|
Returns true with probability
Definition at line 85 of file random.hpp. References uniform(). Referenced by Arak::CN94Proposal::sampleMoveBdVertexPastCorner(), Arak::ModifiedCN94Proposal::sampleRecolor(), Arak::CN94Proposal::sampleRecolor(), and Arak::ModifiedCN94Proposal::sampleSlideInteriorVertex(). |
|
Returns a sample from the binomial distribution with success probability
Definition at line 93 of file random.hpp. |
|
Samples a point uniformly from a triangle.
Definition at line 135 of file random.hpp. References Arak::Geometry::Point, Arak::Geometry::Triangle, uniform(), and Arak::Geometry::Vector. |
|
Samples a point uniformly from a line segment.
Definition at line 123 of file random.hpp. References Arak::Geometry::Point, Arak::Geometry::Segment, and uniform(). |
|
Samples a point uniformly from a line segment.
Definition at line 104 of file random.hpp. References Arak::Geometry::Point, uniform(), and Arak::Geometry::Vector. |
|
Returns a pseudorandom integer in the range
Definition at line 77 of file random.hpp. |
|
Returns a pseudorandom real number in the range
Definition at line 68 of file random.hpp. |
|
|
Writes a short description of this PRNG to the supplied stream.
Definition at line 155 of file random.hpp. Referenced by operator<<(). |
|
The underlying pseudorandom number generator.
Definition at line 26 of file random.hpp. |