1: // prng -- A psuedo random number generator. 3: #include "prng.H" 5: prng::prng(int seed) { 6: double lo = 0.0; 7: double hi = 1.0; 9: // Instantiate an additive congruential generator. 10: acg = new ACG(seed, size); 12: // Instantiate a uniform random number generator over the interval (0,1). 13: urng = new Uniform(lo, hi, acg); 15: } 18: long prng::next(long low, long high) { // next random integer 19: double result = (*urng)(); 20: return (long)(result*(double)(high - low)) + low; 21: }