Retrieves the current table used in the 64-bit Mersenne Twister generator.
void imsls_random_MT64_table_get (unsigned long long **table, ..., 0)
unsigned long long **table (Output)
Address of a pointer to an
array of length 625 containing the table used in the 64-bit Mersenne Twister
generator. Typically, unsigned long long *table is declared and &table is used as an argument.
void imsls_random_MT64_table_get (unsigned long long **table,
IMSLS_RETURN_USER, unsigned
long long r[],
0)
IMSLS_RETURN_USER, unsigned long long r[] (Output)
User-supplied array of length 625 containing the table used in the 64-bit Mersenne Twister generator.
The values in the table contain the state of the 64-bit Mersenne Twister random number generator. The table can be used by imsls_random_MT64_table_set to set the generator back to this state.
In this example, four simulation streams are generated. The first series is generated with the seed used for initialization. The second series is generated using an array for initialization. The third series is obtained by resetting the generator back to the state it had at the beginning of the second stream. Therefore the second and third streams are identical. The fourth stream is obtained by resetting the generator back to its original, uninitialized state, and having it reinitialize using the seed. The fourth and first streams are therefore the same.
const unsigned long long init[] = {0x123, 0x234, 0x345, 0x456};
/* Initialize 64-bit Mersenne Twister series with a seed */
imsls_random_seed_set (iseed);
r = imsls_f_random_uniform (nr, 0);
imsls_f_write_matrix ("First stream output", 1, 5, r,
/* Reinitialize Mersenne Twister series with an array */
imsls_random_MT64_init(4, init);
/* Save the state of the series */
imsls_random_MT64_table_get(&itable, 0);
r = imsls_f_random_uniform (nr, 0);
imsls_f_write_matrix ("Second stream output", 1, 5, r,
/* Restore the state of the series */
imsls_random_MT64_table_set(itable);
r = imsls_f_random_uniform (nr, 0);
imsls_f_write_matrix ("Third stream output", 1, 5, r,
/* Reset the series - it will reinitialize from the seed */
imsls_random_MT64_table_set(itable);
r = imsls_f_random_uniform (nr, 0);
imsls_f_write_matrix ("Fourth stream output", 1, 5, r,
0.5799 0.9401 0.7102 0.1640 0.5457
0.4894 0.7397 0.5725 0.0863 0.7588
0.4894 0.7397 0.5725 0.0863 0.7588
0.5799 0.9401 0.7102 0.1640 0.5457
Visual Numerics, Inc. PHONE: 713.784.3131 FAX:713.781.9260 |