# # # patch "randomizer.cc" # from [d850c6502f8bf322b62569029f434d1051839a42] # to [144210adc11503d17d44152dec7e1779d0426c16] # # patch "randomizer.hh" # from [77aa63e7e4b074cf450efa083288425a4ab3abc8] # to [c4b81193a356206d33540e2c6c9f47d5cb511f13] # # patch "unit_tests.cc" # from [f1f7a69290901922aeef3686283ec6cea1687302] # to [3950a1e595ac694d5d80c47198c31b450eec8152] # ============================================================ --- randomizer.cc d850c6502f8bf322b62569029f434d1051839a42 +++ randomizer.cc 144210adc11503d17d44152dec7e1779d0426c16 @@ -8,20 +8,25 @@ // PURPOSE. #include "randomizer.hh" +#include +#include +#include +typedef boost::mt19937 & rng_t; + bool randomizer::flip(size_t n) { return bernoulli(1.0 / static_cast(n)); } size_t randomizer::uniform(size_t n) -{ - return boost::random_number_generator(rng)(n); +{ + typedef boost::uniform_int dist_t; + return boost::variate_generator(rng, dist_t(0, n-1))(); } bool randomizer::bernoulli(double p) { - typedef boost::mt19937& rng_t; typedef boost::bernoulli_distribution dist_t; return boost::variate_generator(rng, dist_t(p))(); } ============================================================ --- randomizer.hh 77aa63e7e4b074cf450efa083288425a4ab3abc8 +++ randomizer.hh c4b81193a356206d33540e2c6c9f47d5cb511f13 @@ -15,20 +15,20 @@ // Our purpose is to create a global randomization utility for unit // tests. Nothing fancy. -#include -#include +#include +#include struct randomizer { boost::mt19937 rng; // uniform process in [0,n] - size_t uniform(size_t n); + std::size_t uniform(std::size_t n); // boolean process with prob(true) = p, prob(false) = 1-p. bool bernoulli(double p); - bool flip(size_t n = 2); + bool flip(std::size_t n = 2); }; #endif ============================================================ --- unit_tests.cc f1f7a69290901922aeef3686283ec6cea1687302 +++ unit_tests.cc 3950a1e595ac694d5d80c47198c31b450eec8152 @@ -391,7 +391,7 @@ int main(int argc, char * argv[]) { unrecognized = true; cerr << argv[0] << ": unrecognized test: " - << group << '\n'; + << group << ':' << test << '\n'; continue; } to_run.push_back(t->second);