![]() |
Rosetta
2015.38
|
Random number generator system. More...
#include <random.hh>
Public Types | |
typedef double | result_type |
![]() | |
typedef platform::Size | Size |
typedef platform::Size | size_type |
Public Member Functions | |
~RandomGenerator () | |
double | uniform () |
double | gaussian () |
Get Gaussian distribution random number. More... | |
int | random_range (int low, int high) |
Returns a random int in the range specified by the arguments. More... | |
int | get_seed () const |
Return the seed used by this RNG. More... | |
void | set_seed (std::string const &generator_type, int seed) |
Set the seed and the generator type synchronously. Currently the two supported generator types are "standard" and "mt19937" with the latter being the recommended form. More... | |
void | set_seed (int seed) |
Return the seed used by this RNG. More... | |
void | saveState (std::ostream &out) |
void | restoreState (std::istream &in) |
template<class T > | |
T const & | random_element (utility::vector1< T > const &v) |
return a random element from a utility::vector1. What is this function doing inside the RandomGenerator class? More... | |
double | operator() () |
double | min () const |
double | max () const |
![]() | |
ReferenceCount () | |
Default constructor. More... | |
virtual | ~ReferenceCount () |
Private Member Functions | |
RandomGenerator () | |
RandomGenerator (RandomGenerator const &) | |
Private Attributes | |
uniform_RG_OP | generator_ |
bool | gaussian_iset_ |
data for Gaussian generation More... | |
double | gaussian_gset_ |
Friends | |
RandomGenerator & | rg () |
Return the one-per-thread "singleton" random generator. More... | |
Random number generator system.
|
private |
|
private |
numeric::random::RandomGenerator::~RandomGenerator | ( | ) |
double numeric::random::RandomGenerator::gaussian | ( | ) |
Get Gaussian distribution random number.
SL: this is function is ported from old Rosetta++.
Returns a gaussian random number (normally distributed deviate with zero mean and unit variance) using ran3 as a source of uniform deviates. Always call with the same idum
References gaussian_gset_, gaussian_iset_, numeric::log(), and uniform().
Referenced by numeric::random::gaussian(), operator()(), numeric::random::random_point_on_unit_sphere(), numeric::random::random_rotation_angle(), and numeric::random::random_translation().
int numeric::random::RandomGenerator::get_seed | ( | ) | const |
Return the seed used by this RNG.
References generator_.
|
inline |
|
inline |
|
inline |
References gaussian().
|
inline |
return a random element from a utility::vector1. What is this function doing inside the RandomGenerator class?
References random_range().
Returns a random int in the range specified by the arguments.
Returns a random int in the range specified by the arguments, with both enpoints being included in the possible output.
References numeric::random::uniform().
Referenced by main(), random_element(), numeric::IntervalSet< double >::random_point(), numeric::random::random_range(), and numeric::random::reservoir_sample().
void numeric::random::RandomGenerator::restoreState | ( | std::istream & | in | ) |
References gaussian_gset_, gaussian_iset_, and generator_.
void numeric::random::RandomGenerator::saveState | ( | std::ostream & | out | ) |
References gaussian_gset_, gaussian_iset_, and generator_.
void numeric::random::RandomGenerator::set_seed | ( | std::string const & | generator_type, |
int | seed | ||
) |
Set the seed and the generator type synchronously. Currently the two supported generator types are "standard" and "mt19937" with the latter being the recommended form.
References numeric::random::createRG(), and generator_.
Referenced by PerformanceBenchmark::execute().
void numeric::random::RandomGenerator::set_seed | ( | int | seed | ) |
Return the seed used by this RNG.
References generator_.
double numeric::random::RandomGenerator::uniform | ( | ) |
Return from range [0, 1] (?) uniform random number
The implementation of random_range leads me to believe this is actually [0, 1), like most other random number generators. -IWD
References generator_.
Referenced by gaussian(), gen_pep_bb_sequential(), mutate_random_residue(), numeric::random::pick_random_index_from_cdf(), numeric::random::random_permutation(), numeric::IntervalSet< double >::random_point(), numeric::random::WeightedSampler::random_sample(), numeric::random::reservoir_sample(), run_pep_prep(), RunPepSpec(), and numeric::random::uniform().
|
friend |
Return the one-per-thread "singleton" random generator.
|
private |
Referenced by gaussian(), restoreState(), and saveState().
|
private |
data for Gaussian generation
Referenced by gaussian(), restoreState(), and saveState().
|
private |
Referenced by get_seed(), restoreState(), saveState(), set_seed(), and uniform().