+/* $NetBSD: random.c,v 1.4 1997/10/12 11:45:43 lukem Exp $ */
+
/*
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Timothy C. Stoehr.
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
-static char sccsid[] = "@(#)random.c 5.3 (Berkeley) 6/1/90";
+#if 0
+static char sccsid[] = "@(#)random.c 8.1 (Berkeley) 5/31/93";
+#else
+__RCSID("$NetBSD: random.c,v 1.4 1997/10/12 11:45:43 lukem Exp $");
+#endif
#endif /* not lint */
+#include "rogue.h"
+
/*
* random.c
*
static int rand_sep = 3;
static long *end_ptr = &rntb[32];
+void
srrandom(x)
-int x;
+ int x;
{
- register int i;
- long rrandom();
+ int i;
state[0] = (long) x;
if (rand_type != 0) {
return(i);
}
+int
get_rand(x, y)
-register int x, y;
+ int x, y;
{
- register int r, t;
+ int r, t;
long lr;
if (x > y) {
return(r);
}
+int
rand_percent(percentage)
-register int percentage;
+ int percentage;
{
return(get_rand(1, 100) <= percentage);
}
+int
coin_toss()
{
-
return(((rrandom() & 01) ? 1 : 0));
}