I like the ability to specify the random number generator (RNG) in functions like rand().
This feature would be much more useful if we could tell rand() to use the default RNG, rather than one we supply. This could be achieved either by:
- Exposing the name of the default RNG (that is, the one we seed with srand()), or
- Making the RNG a keyword argument.
This problem arises because I have some pieces of code that I sometimes want to run with the system RNG and sometimes without. Right now, I can not find an elegant way to do this, and have to either use a branch or duplicate a lot of code.
I originally tried to resolve the problem by having my code create a new RNG when one is not specified. However, this was happening so often that the creation of the MersenneTwister became the dominant cost of the computation.