]> git.ozlabs.org Git - ppp.git/blobdiff - NeXT/random.c
Update from Steve Perkins
[ppp.git] / NeXT / random.c
diff --git a/NeXT/random.c b/NeXT/random.c
deleted file mode 100644 (file)
index 1c44fa1..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Because the standard library random number
- * functions are not availble at the kernel level
- * I wrote this simple random number generator.
- *
- * It uses the multiplicative congruential method.
- * See pg 263 of Banks and Carson "Discrete-Event
- * System Simulation".
- *
- */
-
-#include "random.h"
-
-static unsigned x0=123457;     /* seed */
-static unsigned a=16807;       /* constant multiplier */
-static unsigned c=0;           /* increment */
-static unsigned m=2147483647;  /* modulus */
-
-/*
- * Set the seed to the argument.
- */
-
-void srand(unsigned i)
-{
-  x0 = i;
-}
-
-
-/*
- * Use Linear Congruential Method to Generate
- * sequence.  Return either int or float...
- */
-  
-unsigned rand(void)
-{
-  unsigned tmpseed;
-
-  tmpseed = (a*x0+c) % m;
-  x0 = tmpseed;
-  return (unsigned) x0;
-}
-
-
-
-float frand(void)
-{
-  unsigned tmpseed;
-
-  tmpseed = (a*x0+c) % m;
-  x0 = tmpseed;
-  return (x0/(float)m);
-}