On Fri, Aug 2, 2024 at 9:37 AM Robert Kern <robert.k...@gmail.com> wrote:
> On Fri, Aug 2, 2024 at 1:28 AM Andrew Nelson <andyf...@gmail.com> wrote: > >> When using the new `Generator`s for stochastic optimisation I sometimes >> find myself possessing a great solution, but am wondering what path the >> random number generation took to get to that point. >> >> I know that I can get the current state of the BitGenerators. However, >> what I'd like to do is query the BitGenerator to figure out how the >> BitGenerator was setup in the first place. >> >> i.e. either: >> >> - the seed/SeedSequence that was used to construct the BitGenerator >> > > >>> rng = np.random.default_rng() > >>> rng.bit_generator.seed_seq > SeedSequence( > entropy=186013007116029215180532390504704448637, > ) > > In some older versions of numpy, the attribute was semi-private as > _seed_seq, if you're still using one of those. > > In many cases you can add your own attributes to python objects, so you can record the seed yourself as rng.my_seed = blah I didn't test if the BitGenerator supports this -- *Those who don't understand recursion are doomed to repeat it*
_______________________________________________ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address: arch...@mail-archive.com