Re: cross python version randomness

2017-03-21 Thread Robin Becker
On 21/03/2017 09:43, Pavol Lisy wrote: On 3/21/17, Kev Dwyer wrote: Robin Becker wrote: Is there a way to get the same sequences of random numbers in python 2.7 and python >= 3.3? I notice that this simple script produces different values in python 2.7 and >=3.3 C:\code\hg-repos\reportlab>c

Re: cross python version randomness

2017-03-21 Thread Steve D'Aprano
On Tue, 21 Mar 2017 08:30 pm, Robin Becker wrote: > Looking in random.py it sesms to be true. Pity no backwards compatibility > mode. I don't actually care about the quality of the ints produced, but I > do care about reproducibility, luckily I think it's feasible to monkey > patch the 2.7 method

Re: cross python version randomness

2017-03-21 Thread Pavol Lisy
On 3/21/17, Kev Dwyer wrote: > Robin Becker wrote: > >> Is there a way to get the same sequences of random numbers in python 2.7 >> and python >= 3.3? >> >> I notice that this simple script produces different values in python 2.7 >> and >=3.3 >> >> C:\code\hg-repos\reportlab>cat s.py >> import sys

Re: cross python version randomness

2017-03-21 Thread Robin Becker
.. presumably randint is doing something different to get its values. The docs [https://docs.python.org/3/library/random.html#random.randrange] for randrange have this note: Changed in version 3.2: randrange() is more sophisticated about producing equally distributed values. Formerly

Re: cross python version randomness

2017-03-20 Thread Kev Dwyer
Robin Becker wrote: > Is there a way to get the same sequences of random numbers in python 2.7 > and python >= 3.3? > > I notice that this simple script produces different values in python 2.7 > and >=3.3 > > C:\code\hg-repos\reportlab>cat s.py > import sys, random > print(sys.version) > random.

cross python version randomness

2017-03-20 Thread Robin Becker
Is there a way to get the same sequences of random numbers in python 2.7 and python >= 3.3? I notice that this simple script produces different values in python 2.7 and >=3.3 C:\code\hg-repos\reportlab>cat s.py import sys, random print(sys.version) random.seed(103) for i in range(5): print