Launder seed generation through rand() to ensure seed diversity. 25/head
authorJason S. Ninneman <jsn@mbar.us>
Tue, 30 May 2017 18:06:53 +0000 (11:06 -0700)
committerJason S. Ninneman <jsn@mbar.us>
Tue, 30 May 2017 21:58:55 +0000 (14:58 -0700)
This doesn't affect reproducibility because a) the seed value written to logs is the output of this process, and b) the argument to the seed command *doesn't* get laundered.

main.c

diff --git a/main.c b/main.c
index 7a065b2fd91ca3dc4f955be85b93f893f99ca558..653b744b0040b8b8a330dc15ac197463f8eb53e5 100644 (file)
--- a/main.c
+++ b/main.c
@@ -110,7 +110,8 @@ int main(int argc, char *argv[]) {
        lcgstate.a = 1093;
        lcgstate.c = 221587;
        lcgstate.m = 1048576;
-       long seedval = (long)time(NULL);
+       srand(time(NULL));
+       long seedval = (long)rand();
        set_seed(seedval);
 
 /*  Read the database if we have not yet done so */