1 *** crypto/mersenne/mt19937db.c 2002/03/27 04:31:10 1.8
2 --- crypto/mersenne/mt19937db.c 2002/09/17 19:43:30 1.9
8 ! unsigned long i, s, y;
9 static unsigned long mag01[2]={0x0, MATRIX_A};
10 /* mag01[x] = x * MATRIX_A for x=0,1 */
11 ! u_int32_t secs, usecs;
12 ! u_int8_t mac[DB_MAC_KEY];
15 * We are called with the mt_mutexp locked
21 static unsigned long mag01[2]={0x0, MATRIX_A};
22 /* mag01[x] = x * MATRIX_A for x=0,1 */
23 ! u_int32_t secs, seed, usecs;
26 * We are called with the mt_mutexp locked
29 if (dbenv->mti == N+1) { /* if sgenrand() has not been called, */
31 * Seed the generator with the hashed time. The __db_mac
32 ! * function returns a 20 byte value, but we can safely
33 ! * just use the first 4 bytes for the seed.
36 if (__os_clock(dbenv, &secs, &usecs) != 0)
37 return (0); /* 0 is the only invalid return */
38 ! __db_chksum((u_int8_t *)&secs, sizeof(secs), NULL, mac);
40 ! for (i = 0; i < DB_MAC_KEY && s == 0;
41 ! i += sizeof(unsigned long))
44 ! __db_sgenrand(s, dbenv->mt, &dbenv->mti);
47 for (kk=0;kk<N-M;kk++) {
49 if (dbenv->mti == N+1) { /* if sgenrand() has not been called, */
51 * Seed the generator with the hashed time. The __db_mac
52 ! * function will return 4 bytes if we don't send in a key.
55 if (__os_clock(dbenv, &secs, &usecs) != 0)
56 return (0); /* 0 is the only invalid return */
57 ! __db_chksum((u_int8_t *)&secs, sizeof(secs), NULL,
59 ! } while (seed == 0);
60 ! __db_sgenrand((long)seed, dbenv->mt, &dbenv->mti);
63 for (kk=0;kk<N-M;kk++) {