date and time created 83/03/23 15:00:57 by mckusick
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Thu, 24 Mar 1983 07:00:57 +0000 (23:00 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Thu, 24 Mar 1983 07:00:57 +0000 (23:00 -0800)
SCCS-vsn: games/trek/ranf.c 4.1

usr/src/games/trek/ranf.c [new file with mode: 0644]

diff --git a/usr/src/games/trek/ranf.c b/usr/src/games/trek/ranf.c
new file mode 100644 (file)
index 0000000..89a7773
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef lint
+static char sccsid[] = "@(#)ranf.c     4.1     (Berkeley)      %G%";
+#endif not lint
+
+ranf(max)
+int    max;
+{
+       register int    t;
+
+       if (max <= 0)
+               return (0);
+       t = rand() >> 5;
+       return (t % max);
+}
+
+
+double franf()
+{
+       double          t;
+       t = rand() & 077777;
+       return (t / 32767.0);
+}