@@ -72,13 +72,6 @@ was made will be noted in the relevant docstring. Extension of existing
72
72
parameter ranges and the addition of new parameters is allowed as long the
73
73
previous behavior remains unchanged.
74
74
75
- ``mt19937.RandomState`` can be used in parallel applications by
76
- calling the method ``jump`` which advances the state as-if :math:`2^{128}`
77
- random numbers have been generated [2]_. This allows the original sequence to
78
- be split so that distinct segments can be used in each worker process. All
79
- generators should be initialized with the same seed to ensure that the
80
- segments come from the same sequence.
81
-
82
75
Parameters
83
76
----------
84
77
seed : {None, int, array_like}, optional
@@ -96,4 +89,54 @@ pseudo-random number generator with a number of methods that are similar
96
89
to the ones available in ``RandomState``. ``RandomState``, besides being
97
90
NumPy-aware, has the advantage that it provides a much larger number
98
91
of probability distributions to choose from.
92
+
93
+ **Parallel Features**
94
+
95
+ ``mt19937.RandomState`` can be used in parallel applications by
96
+ calling the method ``jump`` which advances the state as-if :math:`2^{128}`
97
+ random numbers have been generated ([1]_, [2]_). This allows the original sequence to
98
+ be split so that distinct segments can be used in each worker process. All
99
+ generators should be initialized with the same seed to ensure that the
100
+ segments come from the same sequence.
101
+
102
+ >>> from randomstate.entropy import random_entropy
103
+ >>> import randomstate.prng.mt19937 as rnd
104
+ >>> seed = random_entropy()
105
+ >>> rs = [rnd.RandomState(seed) for _ in range(10)]
106
+ # Advance rs[i] by i jumps
107
+ >>> for i in range(10):
108
+ rs[i].jump(i)
109
+
110
+ References
111
+ ----------
112
+ .. [1] Hiroshi Haramoto, Makoto Matsumoto, and Pierre L\' Ecuyer, "A Fast
113
+ Jump Ahead Algorithm for Linear Recurrences in a Polynomial Space",
114
+ Sequences and Their Applications - SETA, 290--298, 2008.
115
+ .. [2] Hiroshi Haramoto, Makoto Matsumoto, Takuji Nishimura, François
116
+ Panneton, Pierre L\' Ecuyer, "Efficient Jump Ahead for F2-Linear
117
+ Random Number Generators", INFORMS JOURNAL ON COMPUTING, Vol. 20,
118
+ No. 3, Summer 2008, pp. 385-390.
119
+
120
+ """
121
+
122
+ DEF JUMP_DOCSTRING = u """
123
+ jump(iter = 1)
124
+
125
+ Jumps the state of the random number generator as-if 2**128 random numbers
126
+ have been generated.
127
+
128
+ Parameters
129
+ ----------
130
+ iter : integer, positive
131
+ Number of times to jump the state of the prng.
132
+
133
+ Returns
134
+ -------
135
+ out : None
136
+ Returns 'None' on success.
137
+
138
+ Notes
139
+ -----
140
+ Jumping the rng state resets any pre-computed random numbers. This is required
141
+ to ensure exact reproducibility.
99
142
"""
0 commit comments