random.patch.txt
In the original Python random module it is enough to set seed to the same value to reproduce the entire pseudo-random sequence. Transcrypt's random module has a bug in the seed function that causes the module to (generally speaking) produce a completely different random numbers after the seed is set to the same value as before. Here is a minimal example code:
import random
random.seed(123)
print(random.random())
random.seed(123)
print(random.random())
The issue is due to the fact that the seed function in the Transcrypt module random does not reset variable '_index' to its initial value of zero. So, the fix is rather trivial (see attached file random.patch.txt).
random.patch.txt
In the original Python random module it is enough to set seed to the same value to reproduce the entire pseudo-random sequence. Transcrypt's random module has a bug in the seed function that causes the module to (generally speaking) produce a completely different random numbers after the seed is set to the same value as before. Here is a minimal example code:
import random
random.seed(123)
print(random.random())
random.seed(123)
print(random.random())
The issue is due to the fact that the seed function in the Transcrypt module random does not reset variable '_index' to its initial value of zero. So, the fix is rather trivial (see attached file random.patch.txt).