Is it possible to generate the same random number in python as in java if given the same seed
Explained in a more accurate way, Is it possible to use the linear congruential formula from java in Python?
Have you taken a look at this project? http://pypi.python.org/pypi/java-random
Using Pyjnius:
from jnius import autoclass
rand = autoclass('java.util.Random')()
rand.setSeed(12345)
print(rand.nextInt(50))
print(rand.nextInt(50))
print(rand.nextInt(50))
print(rand.nextInt(50))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With