summaryrefslogtreecommitdiff
path: root/games/monop
diff options
context:
space:
mode:
authorChristian Weisgerber <naddy@cvs.openbsd.org>2013-08-29 20:22:23 +0000
committerChristian Weisgerber <naddy@cvs.openbsd.org>2013-08-29 20:22:23 +0000
commit8ce81dbb9ce96aff37591175c4be0778150c387c (patch)
treefe2cf8a0e8381920812ba877a940668255c15104 /games/monop
parent514acfbf4d29506078ac09ba5d85f12a80634c1f (diff)
replace srandomdev()+random() with the arc4random*() family
tweaks and ok millert@, ok deraadt@
Diffstat (limited to 'games/monop')
-rw-r--r--games/monop/monop.c3
-rw-r--r--games/monop/roll.c8
2 files changed, 4 insertions, 7 deletions
diff --git a/games/monop/monop.c b/games/monop/monop.c
index 918557d13d5..db433b67cf7 100644
--- a/games/monop/monop.c
+++ b/games/monop/monop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monop.c,v 1.10 2009/10/27 23:59:26 deraadt Exp $ */
+/* $OpenBSD: monop.c,v 1.11 2013/08/29 20:22:16 naddy Exp $ */
/* $NetBSD: monop.c,v 1.3 1995/03/23 08:34:52 cgd Exp $ */
/*
@@ -47,7 +47,6 @@ main(ac, av)
int ac;
char *av[];
{
- srandomdev();
num_luck = sizeof lucky_mes / sizeof (char *);
init_decks();
init_monops();
diff --git a/games/monop/roll.c b/games/monop/roll.c
index 9d7f45967e3..501e177a204 100644
--- a/games/monop/roll.c
+++ b/games/monop/roll.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: roll.c,v 1.5 2009/10/27 23:59:26 deraadt Exp $ */
+/* $OpenBSD: roll.c,v 1.6 2013/08/29 20:22:16 naddy Exp $ */
/* $NetBSD: roll.c,v 1.5 1995/03/23 08:35:13 cgd Exp $ */
/*
@@ -39,12 +39,10 @@ int
roll(ndie, nsides)
int ndie, nsides;
{
- int tot, r;
- double num_sides;
+ int tot;
- num_sides = nsides;
tot = 0;
while (ndie--)
- tot += (r = random()) * (num_sides / RAND_MAX) + 1;
+ tot += arc4random_uniform(nsides) + 1;
return tot;
}