#include #include #include #include "krand.h" #include #define MBIG 1000000000L #define MSEED 161803398L #define FAC (1.0 / MBIG) static int inext; static int inextp; static long ma[56]; double knuth_random(void) { long mj; if (++inext == 56) inext = 1; if (++inextp == 56) inextp = 1; mj = ma[inext] - ma[inextp]; if (mj < 0) mj += MBIG; ma[inext] = mj; return mj * FAC; } long seed_random(long seed) { long mj, mk; register int i, k; if (seed < 0) { time_t tp; seed = time(&tp); } if (seed >= MBIG) { cerr<<"Seed value too big (> "<= max) { cout<<"ERROR: random num generator out of bounds!"<