Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-29 Thread Robert Kern
On Mon, Jun 29, 2020 at 11:30 AM Robert Kern wrote: > On Mon, Jun 29, 2020 at 11:10 AM Kevin Sheppard < > kevin.k.shepp...@gmail.com> wrote: > >> >>1. The total number of digits in the binary representation is >>somewhere between 32 and 128. >> >> > I like using the standard library

Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-29 Thread Robert Kern
On Mon, Jun 29, 2020 at 11:10 AM Kevin Sheppard wrote: > It can be anything, but “good practice” is to use a number that would have > 2 properties: > > > >1. When expressed as binary number, it would have a large number of >both 0s and 1s > > The properties of the SeedSequence algorithm

Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-29 Thread Kevin Sheppard
It can be anything, but “good practice” is to use a number that would have 2 properties: When expressed as binary number, it would have a large number of both 0s and 1sThe total number of digits in the binary representation is somewhere between 32 and 128. The binary representation of the one I

Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-29 Thread Evgeni Burovski
Thanks Kevin! A possibly dumb follow-up question: in your example, > entropy = 382193877439745928479635728 is it relevant that `entropy` is a long integer? I.e., what are the constraints on its value, can one use entropy = 1234 or entropy = 0 or entropy = 1 instead? On Mon, Jun 29, 2020

Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-29 Thread Robert Kern
On Mon, Jun 29, 2020 at 8:02 AM Neal Becker wrote: > I was using this to reset the generator, in order to repeat the same > sequence again for testing purposes. > In general, you should just pass in a new Generator that was created with the same seed. def function_to_test(rg): x =

Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-29 Thread Matti Picus
On 6/29/20 5:37 PM, Kevin Sheppard wrote: The best practice is to use a SeedSequence to spawn child SeedSequences, and then to use these children to initialize your generators or bit generators.  

Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-29 Thread Kevin Sheppard
The best practice is to use a SeedSequence to spawn child SeedSequences, and then to use these children to initialize your generators or bit generators.  from numpy.random import SeedSequence, Generator, PCG64, default_rng entropy = 382193877439745928479635728 seed_seq =

Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-29 Thread Evgeni Burovski
(apologies for jumping into a conversation) So what is the recommendation for instantiating a number of generators with manually controlled seeds? The use case is running a series of MC simulations with reproducible streams. The runs are independent and are run in parallel in separate OS

Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-29 Thread Kevin Sheppard
If you want to use the same entropy-initialized generator for temporarily-reproducible experiments, then you can use gen = np.random.default_rng()state = gen.bit_generator.stategen.standard_normal()# 0.5644742559549797, will vary across runsgen.bit_generator.state = stategen.standard_normal()#

Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-29 Thread Neal Becker
I was using this to reset the generator, in order to repeat the same sequence again for testing purposes. On Wed, Jun 24, 2020 at 6:40 PM Robert Kern wrote: > On Wed, Jun 24, 2020 at 3:31 PM Neal Becker wrote: > >> Consider the following: >> >> from numpy.random import default_rng >> rs =