projects
/
open-adventure.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c703bd7
)
Take srand()/rand() out of the initialization chain...
author
Eric S. Raymond
<esr@thyrsus.com>
Wed, 24 May 2017 15:57:53 +0000
(11:57 -0400)
committer
Eric S. Raymond
<esr@thyrsus.com>
Wed, 24 May 2017 15:57:53 +0000
(11:57 -0400)
...they're not guatanteed to produce consistent across platforms or
libc versions.
misc.c
patch
|
blob
|
history
diff --git
a/misc.c
b/misc.c
index e025c78807f585d76a2db794d2c9cb79a970344e..495a339bfcb51563238604789aea72fec991efe2 100644
(file)
--- a/
misc.c
+++ b/
misc.c
@@
-761,8
+761,7
@@
long TSTBIT;
void set_seed(long seedval)
{
- srand(seedval);
- lcgstate.x = (unsigned long) rand() % lcgstate.m;
+ lcgstate.x = (unsigned long) seedval % lcgstate.m;
}
unsigned long get_next_lcg_value(void)