@@ -112,7 +112,7 @@ def randomize(
112112 m = x .ndim ,
113113 dist = config ["distribution" ],
114114 seed = s ,
115- antithetic = self ._args . antithetic ,
115+ antithetic = self .antithetic ,
116116 )
117117 u = (
118118 target [config ["uncertainty" ]]
@@ -139,7 +139,7 @@ def randomize(
139139 m = x .ndim ,
140140 dist = config ["distribution" ],
141141 seed = s ,
142- antithetic = self ._args . antithetic ,
142+ antithetic = self .antithetic ,
143143 )
144144 b = target [config ["bias" ]]
145145 r = target [config ["rmsd" ]]
@@ -172,6 +172,11 @@ def randomize(
172172 get_logger ().debug (f"mean: { da .nanmean (z ).compute () :.3f} " )
173173 get_logger ().debug (f"std: { da .nanstd (z ).compute () :.3f} " )
174174
175+ @property
176+ def antithetic (self ) -> bool :
177+ """Returns `True` if this Monte Carlo simulation is antithetic."""
178+ return self ._args .antithetic and self ._args .selector % 2 == 0
179+
175180 # noinspection PyShadowingNames
176181 def seed (self , uuid : uuid .UUID , n : int = 4 ) -> np .ndarray :
177182 """
@@ -187,13 +192,18 @@ def seed(self, uuid: uuid.UUID, n: int = 4) -> np.ndarray:
187192 """
188193 from numpy .random import Philox
189194
190- seed = uuid .int + (
195+ seed = uuid .int + self .selector
196+ g = DefaultGenerator (Philox (seed ))
197+ return np .array ([g .next () for _ in range (n )], dtype = np .int64 )
198+
199+ @property
200+ def selector (self ) -> int :
201+ """Returns the effective random stream selector."""
202+ return (
191203 self ._args .selector
192204 if not self ._args .antithetic
193205 else (self ._args .selector + 1 ) // 2
194206 )
195- g = DefaultGenerator (Philox (seed ))
196- return np .array ([g .next () for _ in range (n )], dtype = np .int64 )
197207
198208 def uuid (self , v : str ) -> uuid .UUID :
199209 """
0 commit comments