summaryrefslogtreecommitdiffstats
path: root/games/rain
diff options
context:
space:
mode:
authornaddy <naddy@openbsd.org>2013-08-29 20:22:09 +0000
committernaddy <naddy@openbsd.org>2013-08-29 20:22:09 +0000
commit66e49541875b8761f9d8963cc31a7972678263cb (patch)
tree246cc44c03a53e56d72c01eb9cc14afffc684fed /games/rain
parentAdd support for advanced btcoex. This commit is not really needed (diff)
downloadwireguard-openbsd-66e49541875b8761f9d8963cc31a7972678263cb.tar.xz
wireguard-openbsd-66e49541875b8761f9d8963cc31a7972678263cb.zip
replace srandomdev()+random() with the arc4random*() family
tweaks and ok millert@, ok deraadt@
Diffstat (limited to 'games/rain')
-rw-r--r--games/rain/rain.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/games/rain/rain.c b/games/rain/rain.c
index 348a908c22a..1e8960a5446 100644
--- a/games/rain/rain.c
+++ b/games/rain/rain.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rain.c,v 1.16 2012/05/27 10:09:33 sthen Exp $ */
+/* $OpenBSD: rain.c,v 1.17 2013/08/29 20:22:18 naddy Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -84,7 +84,6 @@ main(int argc, char *argv[])
sleeptime.tv_nsec = delay * 500000;
timespecadd(&sleeptime, &sleeptime, &sleeptime);
- srandomdev();
initscr();
tcols = COLS - 4;
tlines = LINES - 4;
@@ -98,16 +97,16 @@ main(int argc, char *argv[])
curs_set(0);
for (j = 4; j >= 0; --j) {
- xpos[j] = random() % tcols + 2;
- ypos[j] = random() % tlines + 2;
+ xpos[j] = arc4random_uniform(tcols) + 2;
+ ypos[j] = arc4random_uniform(tlines) + 2;
}
for (j = 0;;) {
if (sig_caught) {
endwin();
exit(0);
}
- x = random() % tcols + 2;
- y = random() % tlines + 2;
+ x = arc4random_uniform(tcols) + 2;
+ y = arc4random_uniform(tlines) + 2;
mvaddch(y, x, '.');
mvaddch(ypos[j], xpos[j], 'o');
if (!j--)