diff options
author | nia <nia@NetBSD.org> | 2020-07-26 15:14:09 +0000 |
---|---|---|
committer | nia <nia@NetBSD.org> | 2020-07-26 15:14:09 +0000 |
commit | 05791857e3884b78131a85f78c91c32af0fb5f25 (patch) | |
tree | d2be3b81f528c943f4812f03a9f59c50e9856c63 | |
parent | 71a4bdd386813a0bd96c205cf36b3faf3b1ea0e1 (diff) | |
download | bsdgames-darwin-05791857e3884b78131a85f78c91c32af0fb5f25.tar.gz bsdgames-darwin-05791857e3884b78131a85f78c91c32af0fb5f25.tar.zst bsdgames-darwin-05791857e3884b78131a85f78c91c32af0fb5f25.zip |
Revert arc4random usage for now
this is a host tool and needs to be portable
future plans: add arc4random to libnbcompat
-rw-r--r-- | fortune/strfile/strfile.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fortune/strfile/strfile.c b/fortune/strfile/strfile.c index 29298955..f0d83425 100644 --- a/fortune/strfile/strfile.c +++ b/fortune/strfile/strfile.c @@ -1,4 +1,4 @@ -/* $NetBSD: strfile.c,v 1.41 2020/07/21 03:05:40 nia Exp $ */ +/* $NetBSD: strfile.c,v 1.42 2020/07/26 15:14:09 nia Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -47,7 +47,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\ #if 0 static char sccsid[] = "@(#)strfile.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: strfile.c,v 1.41 2020/07/21 03:05:40 nia Exp $"); +__RCSID("$NetBSD: strfile.c,v 1.42 2020/07/26 15:14:09 nia Exp $"); #endif #endif /* not lint */ #endif /* __NetBSD__ */ @@ -438,6 +438,8 @@ randomize(void) off_t tmp; off_t *sp; + srandom((int)(time(NULL) + getpid())); + Tbl.str_flags |= STR_RANDOM; cnt = Tbl.str_numstr; @@ -446,7 +448,7 @@ randomize(void) */ for (sp = Seekpts; cnt > 0; cnt--, sp++) { - i = arc4random_uniform(cnt); + i = random() % cnt; tmp = sp[0]; sp[0] = sp[i]; sp[i] = tmp; |