jeudi 22 février 2018

Python and Javascript Pseudo Random Number Generator PRNG

I am looking for a way to generate the same sequence of pseudo random integer numbers from both python and javascript.

When I seed in python like this I get the below results:

random.seed(3909461935)   
random.randint(0, 2147483647) = 162048056
random.randint(0, 2147483647) = 489743869
random.randint(0, 2147483647) = 1561110296

I need the same sequence in javascript.

  • Note: I used 2147483647 as the range in the randint method because I am assuming javascript can only handle 32 bit INTs.

Are there any libraries on both sides I can use to generate the same set of pseudo random numbers given the same seed?




Aucun commentaire:

Enregistrer un commentaire