added fractions and RNG::trial
This commit is contained in:
@ -32,6 +32,10 @@ int RNG::get_curr_rand_num() const {
|
||||
return curr_rand_num;
|
||||
}
|
||||
|
||||
bool RNG::trial(fraction &psuccess) {
|
||||
return (rand() % psuccess.denominator) < psuccess.numerator;
|
||||
}
|
||||
|
||||
template<class T> T &RNG::get_rand_in_vector(const std::vector<T> &vec) {
|
||||
curr_rand_num = rand();
|
||||
|
||||
|
Reference in New Issue
Block a user