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
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
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
..
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
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.
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