Python's built-in random provides some possibilities to play with random numbers. To do more powerful and broad operations, one needs to use a 3rd party library, and one of the most common random library for python is numpy's random. It implements different PRNG-s:
PCG64 and Philox have an advance(int n)
method that advances the state by n
. MT19937's state can be advanced by pow(2,128) only, in the so-called units jumps. C++ provides the member function discard that advances the state by 1 or by any arbitrary unsigned long long int.
Why doesn't numpy provide such a feature for the popular PRNG MT19937?
Of course one can generate random numbers and not using them, effectively advancing the state of the PRNG, but wouldn't it be more efficient to iterate the state without projecting it to a random number?
Aucun commentaire:
Enregistrer un commentaire