#include <RandomGenerator.h>
The RandGen generator class is a wrapper around the std::random number generation library. The point of this class is to provide a super easy to use interface for generating Random numbers of canonical scalar distributions (e.g., Uniform, Gaussian, Gamma, Uniform Integer, etc...
Definition at line 34 of file RandomGenerator.h.
Public Types | |
typedef std::mt19937 | GeneratorType |
Static Public Member Functions | |
static double | GetNormal () |
static Eigen::MatrixXd | GetNormal (int rows) |
static Eigen::MatrixXd | GetNormal (int rows, int cols) |
static double | GetUniform () |
static Eigen::MatrixXd | GetUniform (int rows) |
static Eigen::MatrixXd | GetUniform (int rows, int cols) |
static double | GetGamma (double const alpha, double const beta) |
static Eigen::MatrixXd | GetGamma (double const alpha, double const beta, int rows) |
static Eigen::MatrixXd | GetGamma (double const alpha, double const beta, int rows, int cols) |
static int | GetUniformInt (int lb, int ub) |
static Eigen::MatrixXi | GetUniformInt (int lb, int ub, int rows) |
static Eigen::MatrixXi | GetUniformInt (int lb, int ub, int rows, bool unique) |
static Eigen::MatrixXi | GetUniformInt (int lb, int ub, int rows, int cols) |
static Eigen::MatrixXi | GetUniformInt (int lb, int ub, int rows, int cols, bool unique) |
static int | GetDiscrete (std::vector< double > const &discProbs) |
static int | GetDiscrete (Eigen::Ref< const Eigen::VectorXd > const &discProbs) |
static Eigen::MatrixXi | GetDiscrete (std::vector< double > const &discProbs, int rows, int cols=1) |
static Eigen::MatrixXi | GetDiscrete (Eigen::Ref< const Eigen::VectorXd > const &discProbs, int rows, int cols=1) |
static void | SetSeed (int seedval) |
Set the seed for the random number generator. This is a fairly low quality way to do this, but is fine for testing. More... | |
static GeneratorType | CopyGenerator () |
Store a copy of the generator, designed for use with SetGenerator. Be very careful in using this, or you could wreck the library's access to random numbers. More... | |
static void | SetGenerator (GeneratorType) |
Set the state of the generator, designed for use with CopyGenerator. Be very careful in using this, or you could wreck the library's access to random numbers. More... | |
typedef std::mt19937 muq::Utilities::RandomGenerator::GeneratorType |
Definition at line 37 of file RandomGenerator.h.
|
static |
Store a copy of the generator, designed for use with SetGenerator. Be very careful in using this, or you could wreck the library's access to random numbers.
Definition at line 158 of file RandomGenerator.cpp.
References GetGenerator().
|
static |
Definition at line 173 of file RandomGenerator.cpp.
References GetUniform().
|
static |
Definition at line 192 of file RandomGenerator.cpp.
References GetUniform(), and nlohmann::detail::dtoa_impl::k.
|
static |
Sample a discrete distribution with replacement.
Definition at line 168 of file RandomGenerator.cpp.
Referenced by GetDiscrete().
|
static |
Definition at line 187 of file RandomGenerator.cpp.
References GetDiscrete().
|
static |
Definition at line 52 of file RandomGenerator.cpp.
References GetGenerator().
Referenced by GetGamma().
|
inlinestatic |
|
static |
Definition at line 58 of file RandomGenerator.cpp.
References GetGamma().
|
staticprivate |
Definition at line 222 of file RandomGenerator.cpp.
Referenced by CopyGenerator(), GetGamma(), GetNormal(), GetUniform(), GetUniformInt(), muq::Utilities::RandomGeneratorTemporarySetSeed::RandomGeneratorTemporarySetSeed(), SetGenerator(), SetSeed(), and muq::Utilities::RandomGeneratorTemporarySetSeed::~RandomGeneratorTemporarySetSeed().
|
static |
Get a standard Gaussian distribution sample.
Definition at line 37 of file RandomGenerator.cpp.
References GetGenerator().
Referenced by muq::Modeling::LinearSDE::EvolveState(), and GetNormal().
|
inlinestatic |
|
static |
Definition at line 141 of file RandomGenerator.cpp.
References GetNormal(), and nlohmann::detail::dtoa_impl::n.
|
static |
Get a uniformly distributed real sample in [0,1).
Definition at line 45 of file RandomGenerator.cpp.
References GetGenerator().
Referenced by GetDiscrete(), and GetUniform().
|
inlinestatic |
Definition at line 46 of file RandomGenerator.h.
References GetUniform().
Referenced by GetUniform().
|
static |
Definition at line 127 of file RandomGenerator.cpp.
References GetUniform().
|
static |
Get a random integer, distributed uniformly, between the bounds.
Definition at line 76 of file RandomGenerator.cpp.
References GetGenerator().
Referenced by GetUniformInt().
|
inlinestatic |
Definition at line 55 of file RandomGenerator.h.
References GetUniformInt().
Referenced by GetUniformInt().
|
inlinestatic |
Definition at line 56 of file RandomGenerator.h.
References GetUniformInt().
Referenced by GetUniformInt().
|
inlinestatic |
Definition at line 57 of file RandomGenerator.h.
References GetUniformInt().
Referenced by GetUniformInt().
|
static |
Generate N unique random integers from the range lb, ub
Definition at line 85 of file RandomGenerator.cpp.
References GetUniformInt().
|
static |
Set the state of the generator, designed for use with CopyGenerator. Be very careful in using this, or you could wreck the library's access to random numbers.
Definition at line 163 of file RandomGenerator.cpp.
References GetGenerator().
|
static |
Set the seed for the random number generator. This is a fairly low quality way to do this, but is fine for testing.
Definition at line 153 of file RandomGenerator.cpp.
References GetGenerator().
Referenced by muq::Utilities::RandomGeneratorTemporarySetSeed::RandomGeneratorTemporarySetSeed().
|
private |
Definition at line 79 of file RandomGenerator.h.