From: John Darrington Date: Tue, 3 Feb 2004 11:01:23 +0000 (+0000) Subject: Fixed seeding of random number generator. X-Git-Tag: v0.4.0~381 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d52bdc878fbdfa043118c59bec4b24b239724904;p=pspp-builds.git Fixed seeding of random number generator. --- diff --git a/doc/Makefile.am b/doc/Makefile.am index 0f9ca9a9..15ea6557 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -4,4 +4,5 @@ info_TEXINFOS = pspp.texi EXTRA_DIST = pspp.man -MAINTAINERCLEANFILES = Makefile.in README.html pspp.info pspp.info-* +CLEANFILES = pspp.info pspp.info-* +MAINTAINERCLEANFILES=Makefile.in README.html diff --git a/src/ChangeLog b/src/ChangeLog index 61713e2a..b4e2d954 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ + +Tue Feb 3 18:56:45 WST 2004 John Darrington + + * random.c (rng_create): Fixed seeding so that it gets reseeded after + SET seed=xx has been called. + Mon Jan 19 14:08:09 2004 Ben Pfaff * random.c (rng_get_double): Fix always-returning-zero bug in my diff --git a/src/random.c b/src/random.c index 20a70fae..cae3f9e7 100644 --- a/src/random.c +++ b/src/random.c @@ -49,12 +49,13 @@ rng_create (void) static time_t t=0; rng = xmalloc (sizeof *rng); - if (t == 0 || set_seed == NOT_LONG) + if (t == 0 || set_seed_used) { if (set_seed == NOT_LONG) time (&t); else t = set_seed; + set_seed_used=0; } else t++; diff --git a/src/set.q b/src/set.q index c4f80326..89d7ce2c 100644 --- a/src/set.q +++ b/src/set.q @@ -114,6 +114,7 @@ int set_safer; int set_scompression; int set_screen; long set_seed; +int set_seed_used; int set_testing_mode; int set_undefined; int set_viewlength; @@ -616,6 +617,7 @@ stc_custom_seed (struct cmd_set *cmd unused) set_seed = tokval; lex_get (); } + set_seed_used=1; return 1; }