Rosetta
|
Random number generator system. More...
#include <random.hh>
Public Types | |
typedef double | result_type |
Public Member Functions | |
~RandomGenerator () override | |
bool | initialized () const |
Return whether the RandomGenerator has been initialized (by a call to set_seed) More... | |
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 | random_range2 (int low, int high) |
Returns a random int in the range specified by the arguments If low == high, it will return the given integer to simplify code using this. s. 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 |
![]() | |
VirtualBase ()=default | |
Default constructor. More... | |
virtual | ~VirtualBase ()=default |
The virtual destructor is one of the main reasons for the VirtualBase class. More... | |
VirtualBase (VirtualBase const &)=default | |
VirtualBase (VirtualBase &&)=default | |
VirtualBase & | operator= (VirtualBase const &)=default |
VirtualBase & | operator= (VirtualBase &&)=default |
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 |
|
overridedefault |
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(), uniform(), oop_scan::v1, and oop_scan::v2.
Referenced by fit_helix_in_map(), numeric::random::gaussian(), gaussian_angle_move(), jitter_and_minimize(), jitterloop(), operator()(), perturb_and_rescore(), perturb_bb_and_relax(), UniformPerturber::perturb_chain(), numeric::random::random_point_on_unit_sphere(), numeric::random::random_rotation_angle(), numeric::random::random_translation(), sample_near_current_torsion(), sample_near_nucleoside_torsion(), sample_near_suite_torsion(), and update_torsion_set().
int numeric::random::RandomGenerator::get_seed | ( | ) | const |
Return the seed used by this RNG.
References generator_.
Referenced by apps::pilot::KicSandbox::KicSandbox(), main(), and OutputManager::write_header().
bool numeric::random::RandomGenerator::initialized | ( | ) | const |
Return whether the RandomGenerator has been initialized (by a call to set_seed)
The RNG has not been intiliaed if the generator_ object points at null.
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(), and kmeans_adaptive_kernel_density_bb_dependent_rotlib::v.
Referenced by erraser_monte_carlo(), and random_element().
int numeric::random::RandomGenerator::random_range | ( | int | low, |
int | high | ||
) |
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 range, erraser_analysis::temp, and numeric::random::uniform().
Referenced by align_backbone_by_chunk(), CenRotSidechainMover::apply(), PerturbStruct::do_mutate(), CenRotSidechainMover::get_random_rotamer(), kinclose(), main(), pick_random_solution(), ChallengeMover::pick_random_template(), random_element(), numeric::IntervalSet< T >::random_point(), numeric::random::random_range(), random_range2(), ChallengeMover::realign(), numeric::random::reservoir_sample(), myspace::GraftTester::test_cart_graft(), and myspace::GraftTester::test_rb_min_graft().
int numeric::random::RandomGenerator::random_range2 | ( | int | low, |
int | high | ||
) |
Returns a random int in the range specified by the arguments If low == high, it will return the given integer to simplify code using this. s.
References random_range().
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 | ( | int | seed | ) |
Return the seed used by this RNG.
References 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 devel_main(), PerformanceBenchmark::execute(), basic::random::init_random_generators(), main(), and protocols_main().
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 TorsionVectorMover::apply(), LoopHashRelax_Sampler::apply(), CenRotCanonicalMover::apply(), create_random_angle_from_range(), create_random_angle_from_range_list(), create_random_nucleoside_torsion(), create_random_suite_torsion(), create_random_torsions(), double_helix_test(), fit_helix_in_map(), gaussian(), gen_pep_bb_frag(), gen_pep_bb_frag_old(), gen_pep_bb_rama(), gen_pep_bb_sequential(), helix_ST(), initialize_free_and_fixed(), jitter_and_minimize(), kinclose(), lariat_modeling(), main(), make_random_perturbation(), MC_run(), metropolis_criterion(), mutate_random_residue(), my_main(), one_chain_MC_sampling(), one_chain_ST_MC(), perturb_and_rescore(), perturb_bb_and_relax(), UniformPerturber::perturb_chain(), myspace::Scheduler::pick_hashing_res(), numeric::random::pick_random_index_from_cdf(), randangle(), random_angle(), random_delta(), numeric::random::random_permutation(), numeric::IntervalSet< T >::random_point(), numeric::random::WeightedSampler::random_sample(), repack_cluster(), numeric::random::reservoir_sample(), myspace::Scheduler::run_combine(), myspace::Scheduler::run_NM(), run_pep_prep(), RunPepSpec(), sample_near_current_torsion(), sample_near_nucleoside_torsion(), sample_near_suite_torsion(), ConstraintToolMover::show_cstset(), simple_loop_modeling_test(), simple_opte_test(), SomeThing::SomeThing(), test(), myspace::test_bbgauss(), myspace::test_loophash(), numeric::random::uniform(), and update_torsion_set().
|
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(), initialized(), restoreState(), saveState(), set_seed(), and uniform().