comparison src/rand.cc @ 2447:e46137c06781

[project @ 1996-10-30 19:39:03 by jwe]
author jwe
date Wed, 30 Oct 1996 19:39:06 +0000
parents 5a3f1d00a474
children 7ee42ff6536a
comparison
equal deleted inserted replaced
2446:b241766f293a 2447:e46137c06781
122 // work ok to give fairly different seeds each time Octave starts. 122 // work ok to give fairly different seeds each time Octave starts.
123 123
124 static void 124 static void
125 do_initialization (void) 125 do_initialization (void)
126 { 126 {
127 #if 0
128 int s0 = 1234567890;
129 int s1 = 123456789;
130 #else
131 time_t now; 127 time_t now;
132 struct tm *tm; 128 struct tm *tm;
133 129
134 time (&now); 130 time (&now);
135 tm = localtime (&now); 131 tm = localtime (&now);
138 int minute = tm->tm_min + 1; 134 int minute = tm->tm_min + 1;
139 int second = tm->tm_sec + 1; 135 int second = tm->tm_sec + 1;
140 136
141 int s0 = tm->tm_mday * hour * minute * second; 137 int s0 = tm->tm_mday * hour * minute * second;
142 int s1 = hour * minute * second; 138 int s1 = hour * minute * second;
143 #endif
144 139
145 s0 = force_to_fit_range (s0, 1, 2147483563); 140 s0 = force_to_fit_range (s0, 1, 2147483563);
146 s1 = force_to_fit_range (s1, 1, 2147483399); 141 s1 = force_to_fit_range (s1, 1, 2147483399);
147 142
148 F77_FCN (setall, SETALL) (s0, s1); 143 F77_FCN (setall, SETALL) (s0, s1);