Skip to content

Commit b78119c

Browse files
committed
docs on setting seed
1 parent 11b2096 commit b78119c

4 files changed

Lines changed: 13 additions & 5 deletions

File tree

docs/Examples/mm1.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ The following code repeats the experiment 100 times, only recording waits for th
2121
It then returns the average wait in the system::
2222
2323
>>> import ciw
24-
>>> from random import seed
2524
>>> def iteration(warmup):
2625
... N = ciw.create_network(params_dict)
2726
... Q = ciw.Simulation(N)
@@ -30,7 +29,7 @@ It then returns the average wait in the system::
3029
... waits = [row.waiting_time for row in records if row.arrival_date > warmup]
3130
... return sum(waits)/len(waits)
3231
33-
>>> seed(27)
32+
>>> ciw.seed(27)
3433
>>> ws = []
3534
>>> for i in range(100):
3635
... ws.append(iteration(50))

docs/Features/deadlock.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ Parameters::
4040
Running until deadlock::
4141

4242
>>> import ciw
43-
>>> from random import seed
44-
>>> seed(99)
43+
>>> ciw.seed(99)
4544
>>> N = ciw.create_network(params)
4645
>>> Q = ciw.Simulation(N, deadlock_detector='StateDigraph')
4746
>>> Q.simulate_until_deadlock()

docs/Features/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ Contents:
1717
priority.rst
1818
deadlock.rst
1919
state_tracker.rst
20-
exact.rst
20+
exact.rst
21+
seed.rst

docs/Features/seed.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.. _setting-seeds:
2+
3+
=============
4+
Setting Seeds
5+
=============
6+
7+
The Ciw function :code:`ciw.seed` can be used to ensure reproducibility of results. As Ciw uses random number streams from both the :code:`random` and :code:`numpy` modules, this function simply sets the seeds for these.
8+
9+
>>> ciw.seed(5)

0 commit comments

Comments
 (0)