You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2cca437
Browse filesBrowse the repository at this point in the historyBrowse files
DOC: make the CustomSampler examples answer to their seed (#1097)
Both examples build a generator with np.random.default_rng(seed) and drop it,
then sample from the process-global np.random. reset_seed is a no-op, so a
sampler written by following this page ignores random_seed. The study runs and
the numbers look reasonable; only a second run with the same seed shows they
were never reproducible.
The bivariate generator needs two more things. It caches 1000 samples, so
reset_seed has to discard them or the first 1000 draws after a reseed still
come from the generator that was replaced. And its refill test compares
samples_generated against used_samples, which only becomes true after the
cache has run out, so a study longer than the cache silently got short lists:
sample(n_samples=1) returns [] at simulation 1001 and dict_generator raises
IndexError on [0].
Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
0 commit comments