Open rpgoldman opened 10 years ago
Actually a didn´t wrote this part of the code, I copied it from Gene Michael Stover.
This actually seems quite odd because, if I understand it correctly, this will ensure that the random state is not changed when you run this multiple times. If you are trying to get reproducible results for a stream of random numbers, that's precisely not what you want -- you should be leaving it to the caller to copy the random state. After all, the caller has the ability to copy the random state object, but the caller does not have the ability to "un-copy" it if you make a non-destructive version of this function.
If I get a chance, I will provide a patch. Meanwhile, I urge you to leave this issue open until it's fixed.
Why does this set
*mt-random-state*
instead of usingLET
to bind it around the following call? As I read this, it leaks a side-effect of changing the value of the random seed....