|
mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
|
A random number type, which functions like any other arithmetic type.
Combines a random engine, and a random distribution. Using the type conversion operator randomT returns the next random deviate whenever it is referenced.
Example:
Definition at line 58 of file randomT.hpp.
#include <math/randomT.hpp>
Public Types | |
| typedef _randistT | randistT |
| Typedef for the distribution type. | |
| typedef _ranengT | ranengT |
| Typedef for the engine type. | |
Public Member Functions | |
| randomT (bool doSeed=true) | |
| Constructor. | |
| operator typeT () | |
| The conversion operator, returns the next value in the sequence, according to the distribution. | |
| void | seed (typename ranengT::result_type seedval) |
| Set the seed of the random engine. | |
| void | seed () |
| Seed the random engine with a good value. | |
Public Attributes | |
| _randistT | distribution |
| The random distribution. | |
| ranengT | engine |
| The random engine. | |
| typedef _randistT mx::math::randomT< typeT, _ranengT, _randistT >::randistT |
Typedef for the distribution type.
Definition at line 63 of file randomT.hpp.
| typedef _ranengT mx::math::randomT< typeT, _ranengT, _randistT >::ranengT |
Typedef for the engine type.
Definition at line 66 of file randomT.hpp.
|
inline |
Constructor.
By default this calls the seed method, which will use /dev/random to seed the generator on linux, and time(0) on other systems. Set to false to suppress seeding, and/or set a seed with seed(x).
| [in] | doSeed | [optional] if true then the seed method is called upon construction. |
Definition at line 72 of file randomT.hpp.
|
inline |
The conversion operator, returns the next value in the sequence, according to the distribution.
Definition at line 87 of file randomT.hpp.
|
inline |
Seed the random engine with a good value.
Calls mx::math::randomSeed to get the value. On Linux this uses /dev/urandom. On other systems, this uses time(0).
Definition at line 105 of file randomT.hpp.
Referenced by mx::math::randomT< realT, std::mt19937_64, std::normal_distribution< realT > >::randomT(), and mx::math::randomT< realT, std::mt19937_64, std::normal_distribution< realT > >::seed().
|
inline |
Set the seed of the random engine.
Calls the engines seed member function.
| [in] | seedval | the argument to pass to ranengT::seed() |
Definition at line 96 of file randomT.hpp.
Referenced by mx::AO::influenceFunctionsGaussian(), mx::AO::analysis::fourierTemporalPSD< _realT, aosysT >::intensityPSD(), mx::AO::analysis::speckleAmpPSD(), TEST_CASE(), TEST_CASE(), and TEST_CASE().
| _randistT mx::math::randomT< typeT, _ranengT, _randistT >::distribution |
The random distribution.
Definition at line 81 of file randomT.hpp.
Referenced by mx::math::randomT< int, std::mt19937_64, std::poisson_distribution< int > >::operator int().
| ranengT mx::math::randomT< typeT, _ranengT, _randistT >::engine |
The random engine.
Definition at line 84 of file randomT.hpp.