Skip to content

Commit 8366640

Browse files
committed
DOC: say where a Monte Carlo run's seed goes
simulate() gained random_seed with no entry in its own Parameters block, and the stochastic page hands users to the MonteCarlo class without saying that a run is fixed there rather than on the models. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
1 parent cb82e3d commit 8366640

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

‎docs/user/stochastic.rst‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,3 +289,11 @@ better reflecting the inherent uncertainties in rocketry.
289289
.. note::
290290
See the ``MonteCarlo`` class documentation for more information on how to run \
291291
Monte Carlo simulations with stochastic objects.
292+
293+
.. note::
294+
A whole run is fixed by ``MonteCarlo.simulate(random_seed=...)`` rather than
295+
by seeding these models yourself. Each simulation takes its seed from its
296+
own index, so simulation 7 draws the same inputs whether the run was serial
297+
or split over any number of workers, and appending with the same seed
298+
carries the same stream on. Without it a run draws fresh entropy and
299+
reproduces nothing.

‎rocketpy/simulation/monte_carlo.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,20 @@ def simulate(
339339
number of workers will be equal to the number of CPUs available.
340340
A minimum of 2 workers is required for parallel mode.
341341
Default is None.
342+
random_seed : int, sequence of int or numpy.random.SeedSequence, optional
343+
Fixes what every simulation draws. Simulation ``i`` takes the same
344+
inputs whichever way the run was split up, so serial and parallel
345+
results agree and the number of workers does not reach the
346+
sampling. Keyword-only. Default is None, which draws fresh entropy
347+
and reproduces nothing.
348+
349+
Appending continues the same stream when the same seed is given
350+
again, since an index maps to a seed and to nothing else. Nothing
351+
here records the seed, so nothing here can tell you that a later
352+
append was given the same one; that is #1075.
353+
354+
A ``Generator`` or ``BitGenerator`` is refused rather than read.
355+
Pass the seed it was built from.
342356
kwargs : dict
343357
Custom arguments for simulation export of the ``inputs`` file. Options
344358
are:

0 commit comments

Comments
 (0)