Mercurial > hg > octave-lojdl
changeset 1050:705c8ac6bcd4
[project @ 1995-01-19 16:43:42 by jwe]
author | jwe |
---|---|
date | Thu, 19 Jan 1995 16:43:42 +0000 |
parents | e34efb49a229 |
children | 44dcfaf5a5b1 |
files | src/rand.cc |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/rand.cc +++ b/src/rand.cc @@ -123,7 +123,10 @@ if (! initialized) { // Make the random number generator give us a different sequence every -// time we start octave unless we specifically set the seed. +// time we start octave unless we specifically set the seed. The +// technique used below will cycle monthly, but it it does seem to +// work ok to give fairly different seeds each time Octave starts. + #if 0 int s0 = 1234567890; int s1 = 123456789; @@ -134,8 +137,12 @@ time (&now); tm = localtime (&now); - int s0 = tm->tm_min * 60 + tm->tm_sec; - int s1 = (tm->tm_mday - 1) * 24 * 3600 + tm->tm_hour * 3600 + s0; + int hour = tm->tm_hour + 1; + int minute = tm->tm_min + 1; + int second = tm->tm_sec + 1; + + int s0 = tm->tm_mday * hour * minute * second; + int s1 = hour * minute * second; #endif s0 = force_to_fit_range (s0, 1, 2147483563); s1 = force_to_fit_range (s1, 1, 2147483399);