samedi 7 septembre 2019

Mersenne Twister init_by_array() function clarification

I trying to implement cross-platform consistent random number generation with a 32-bit seed. Most post point me to Mersenne Twister or writing my own implementation.

In the source code there is a function called void init_by_array().

Is the only purpose of this function to extend the seed passed 32-bit?

From the ReadMe

init_by_array(init_key, key_length) initializes the state vector by using an array init_key[] of unsigned 32-bit integers of length key_kength. If key_length is smaller than 624, then each array of 32-bit integers gives distinct initial state vector. This is useful if you want a larger seed space than 32-bit word.

Failing to understand this just assuming based on the last sentence.

The code seems to run fine only using init_genrand() and seems to be producing consistent results.




Aucun commentaire:

Enregistrer un commentaire