TinyMT Jump Function
READ ME FIRST
The jump function makes the internal state of TinyMT N-th forward
state. When N is large, the jump calculation is much faster than
generating N pseudorandom numbers. Users can get discrete sub
sequences from pseudorandom number sequence.
The jump function is written in standard C language, with
standard library. But the function is written using
stdint.h and inttypes.h, which are parts of C99 standard.
Three Methods of parallel generation of pseudorandom numbers
using TinyMT
-
Getting multiple sequences of pseudorandom numbers by using
one parameter set and changing seed of initialization. The
sequences obtained by this method are sub sequences of one
long sequence, and it is difficult to know how far each sub
sequences are from other ones. In the worst case, there may be
a duplicated sub-sub sequence. Usually the probability of the
worst case is negligible. Merit of this method is saving
memory in shared memory parallel programing models like
multiple threads model, by setting the parameter set in shared
constant memories.
-
Getting multiple sequences of pseudorandom numbers by
jump. The sequences obtained by this method are also sub
sequences of one long sequence, but how far each sub sequences
are from other ones are known, i.e. the number specified for
jump.
This method also has memory saving merit as above.
-
Getting multiple sequences of pseudorandom numbers by
using multiple parameter sets. The sequences obtained this
method are regarded most independent each other.
This method wastes memories than former methods.
The jump function provides the second method. Our program does
not save memories, users need to change the tinymt structure and
to define parameters as constant to save memories.
Usage
Compilation of test programs
Test program needs source programs of TinyMT to be compiled. And
it needs the output parameter set of TinyMTDC for execution.
- Expand archive file
- Copy jump directory in TinyMTJump-src-xxxx to
the directory of TinyMT.
TinyMT-src-xxx
+---dc
+---tinymt
+---jump
- Change directory to copied jump directory
- Type make all to compile test program.
- Type ./jump_test32 d8524022ed8dff4a8dcc50c798faba43 8f7011ee fc78ff1f 3793fdff 1298
- Check if OK is showed and no NG
description of jump function
-
void tinymt32_jump(tinymt32c_t *tiny,
uint64_t lower_step,
uint64_t upper_step,
const char * poly_str);
- tiny is a structure of type tinymt32_t.
tiny must be initialized.
tiny is overwritten by new jumped state.
- lower_step and upper_step
specifies how many steps tinymt jumps.
Users can specify from zero to 2128-1 steps,
using two 64-bit arguments.
- poly_str is a string of characteristic polynomial,
which is in the first column of outputs of tinymt32dc.
Sample program
Here is a sample program sample.c