From fb7ce38ce123dd7f078123bfad6a1a597c18569c Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Wed, 28 Aug 2019 17:13:16 -0400 Subject: Use rand(3) in beef --- bin/beef.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'bin/beef.c') diff --git a/bin/beef.c b/bin/beef.c index c501f754..556f3088 100644 --- a/bin/beef.c +++ b/bin/beef.c @@ -20,6 +20,7 @@ #include #include #include +#include enum { Cols = 80, @@ -78,7 +79,7 @@ static bool step(void) { return true; } - if (ch == '?') ch = "><^v"[arc4random_uniform(4)]; + if (ch == '?') ch = "><^v"[rand() % 4]; long x, y, v; switch (ch) { @@ -114,6 +115,7 @@ static bool step(void) { } int main(int argc, char *argv[]) { + srand(time(NULL)); memset(page, ' ', sizeof(page)); FILE *file = stdin; -- cgit 1.4.1