|
|
1.1 ! root 1: /* Copyright (c) 1979 Regents of the University of California */ ! 2: ! 3: static char sccsid[] = "@(#)RANDOM.c 1.4 1/10/83"; ! 4: ! 5: #include "h00vars.h" ! 6: ! 7: extern long RAND(); ! 8: ! 9: double ! 10: RANDOM() ! 11: { ! 12: double d; ! 13: long l; ! 14: ! 15: /* ! 16: * calculate (1103515245 * seed) mod 2^31-1 ! 17: */ ! 18: d = 1103515245.0 * _seed / 2147483647.0; ! 19: l = d; ! 20: d = d - l; ! 21: _seed = d * 2147483647.0; ! 22: /* ! 23: * want a value in the range 0..1 ! 24: */ ! 25: return(d); ! 26: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.