15 #include <boost/random/linear_congruential.hpp>
16 #include <boost/random/uniform_real.hpp>
17 #include <boost/random/variate_generator.hpp>
23 static int cached = 0;
24 static double *res =
NULp;
29 int new_size =
std::max(n + 50, cached*4/3);
34 for (
int i=cached+1; i<new_size; i++) {
35 res[i] = res[i-1]+log((
double)i);
46 typedef boost::minstd_rand base_generator_type;
47 typedef boost::uniform_real<> distribution_type;
48 typedef boost::variate_generator<base_generator_type&, distribution_type> generator_type;
51 base_generator_type base;
52 generator_type *generator;
59 generator(new generator_type(base, distribution_type(0, 1)))
67 generator =
new generator_type(base, distribution_type(0, 1));
74 return (*generator)();
111 for (
int i = 0; i<2000; ++i) {
121 void TEST_log_fak() {
122 const double EPS = 0.000001;
124 for (
int loop = 0; loop<=1; ++loop) {
#define TEST_EXPECT_SIMILAR(expr, want, epsilon)
const char * GBS_global_string(const char *templat,...)
void GB_random_seed(unsigned seed)
void ARB_realloc(TYPE *&tgt, size_t nelem)
static RandomNumberGenerator gen(time(NULp))
RandomNumberGenerator(unsigned seed)
void reseed(unsigned seed)
#define TEST_EXPECT_EQUAL(expr, want)