|
|
1.1 root 1: /*
2: Uniform random number generator. Code courtesy of Bob Morris.
3: Linear congruential generator, suitable for 32 bit machines;
4: multiplication is mod 2**31
5: */
6:
7: static long randx = 1;
8:
9: srand_(x) /* subroutine to set seed */
10: long *x;
11: {
12: randx = *x;
13: }
14:
15:
16:
17:
18: double rand_()
19: {
20: double ldexp();
21: return(ldexp((double)(((randx = randx*1103515245 + 12345)>>7) & 077777777), -24));
22: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.