25 using util::isLimited;
56 CHECK (0 <= r1 and r1 < RAND_MAX);
59 CHECK (0 <= r2 and r2 < RAND_MAX);
74 for (uint i=0; i < N; ++i)
75 avg += 1.0/N *
rani (1000);
78 auto error = fabs(avg/expect - 1);
79 CHECK (
error < 0.005);
81 for (uint i=0; i < N; ++i)
82 CHECK (isLimited(0,
rani(5), 4));
84 for (uint i=0; i < N; ++i)
87 auto sqr = [](
double v){
return v*v; };
90 for (uint i=0; i < N; ++i)
91 spread += sqr (ranNormal() - 0.5);
92 spread = sqrt (spread/N);
93 CHECK (spread < 1.12);
111 uint64_t getSeed()
override {
return 55; }
118 uint64_t r2 = src1.u64();
119 double r3 = src1.uni();
122 CHECK (r1 == src2.i32());
123 CHECK (r2 == src2.u64());
124 CHECK (r3 == src2.uni());
127 CHECK (src1.u64() != src2.u64());
129 src2.reseed (coreOfEvil);
130 CHECK (src1.u64() != src2.u64());
132 CHECK (src1.u64() == src2.u64());
133 CHECK (src1.i32() == src2.i32());
134 CHECK (src1.uni() == src2.uni());
int rani(uint bound=_iBOUND())
void verify_reproducibleSequence()
Helpers typically used while writing tests.
Implementation namespace for support and library code.
Simplistic test class runner.
void reseed(SeedNucleus &)
inject controlled randomisation
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Establishes a seed point for any instance or performance.
Generating (pseudo) random numbers with controlled seed.
int i32()
random number from full integer range (incl. negative values)
void verify_distributionVariants()