BSD 4_3 development
authorCSRG <csrg@ucbvax.Berkeley.EDU>
Fri, 20 May 1983 01:01:06 +0000 (17:01 -0800)
committerCSRG <csrg@ucbvax.Berkeley.EDU>
Fri, 20 May 1983 01:01:06 +0000 (17:01 -0800)
Work on file usr/src/usr.lib/libF77/rand_.c.other

Synthesized-from: CSRG/cd1/4.3

usr/src/usr.lib/libF77/rand_.c.other [new file with mode: 0644]

diff --git a/usr/src/usr.lib/libF77/rand_.c.other b/usr/src/usr.lib/libF77/rand_.c.other
new file mode 100644 (file)
index 0000000..cecfbda
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+Uniform random number generator.  Code courtesy of Bob Morris.
+Linear congruential generator, suitable for 32 bit machines;
+multiplication is mod 2**31
+*/
+
+static long    randx = 1;
+
+srand_(x)      /* subroutine to set seed */
+long *x;
+{
+randx = *x;
+}
+
+
+
+
+double rand_()
+{
+double ldexp();
+return(ldexp((double)(((randx = randx*1103515245 + 12345)>>7) & 077777777), -24));
+}