vendredi 2 novembre 2018

Multiple independent random number streams from single seed

I have n similar analyses each using m_i pseudo-random number streams (m_i may vary between analyses). Each analysis has its own random number seed so that the random numbers are uncorrelated between analyses.

My problem is that I need to create the m_i streams from the single seed. The analysis is currently written in Numpy, so solutions its Mersenne Twister are ideal, but I am open to solutions in other mature libraries. I considered these possibilities:

  1. Use the seed to create a random number stream, draw m_i integers, and use those integers as the seeds for m_i random streams. This is not good because of the birthday paradox. There are 2^32 (~4 billion) seeds, but if I would end up with a collision (two streams started with the same seed) after 2^16 (~60000).

  2. Multiply the seed by some constant m_max for each stream index by 1 to get that stream's seed. (e.g. with seed=2 and m_max=10000, the analysis will use seeds 20001, 20002, 20003, etc.). This is undesirable because all analyses will be limited to m_max streams before there will be collisions, and if m_max is too big, the number of analyses is limited to 2^32/m_max.

  3. Use the seed to create a random number stream, draw 624 32-bit integers per stream needed, and set the state of each stream to the 624 integers drawn for it. This seems to be perfect except that I have no idea if 624 random integers is actually a valid internal state for the Mersenne Twister (can it be arbitrary bits?). I also don't know if there is any hidden correlation between the integers (maybe they are the same stream just shifted by 624).

Is there a standard way of doing this?




Aucun commentaire:

Enregistrer un commentaire