Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d9eed57

Browse filesBrowse files
committed
MAINT: remove call to np.random
1 parent de03946 commit d9eed57
Copy full SHA for d9eed57

File tree

Expand file treeCollapse file tree

1 file changed

+5
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-3
lines changed
Open diff view settings
Collapse file

‎py/dynesty/sampler.py‎

Copy file name to clipboardExpand all lines: py/dynesty/sampler.py
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
from .results import Results, print_fn
1515
from .bounding import UnitCube
1616
from .sampling import sample_unif, SamplerArgument
17-
from .utils import (get_seed_sequence, get_print_func, progress_integration,
17+
from .utils import (get_random_generator, get_seed_sequence,
18+
get_print_func, progress_integration,
1819
IteratorResult, RunRecord, get_neff_from_logwt,
1920
compute_integrals, DelayTimer, _LOWL_VAL)
2021

@@ -430,10 +431,11 @@ def _distance_insertion_index(self, start, point):
430431
if distance == 0:
431432
log_ratio = np.inf
432433
else:
433-
other = self.live_u[np.random.choice(len(self.live_u))]
434+
rstate = get_random_generator(self.rstate)
435+
other = self.live_u[rstate.choice(len(self.live_u))]
434436
other_distance = np.linalg.norm((other - start) / norms)
435437
while other_distance == 0:
436-
other = self.live_u[np.random.choice(len(self.live_u))]
438+
other = self.live_u[rstate.choice(len(self.live_u))]
437439
other_distance = np.linalg.norm((other - start) / norms)
438440
alt_distance = np.linalg.norm((point - other) / norms)
439441
log_ratio = self.ndim * (np.log(other_distance / distance) + np.log(other_distance / alt_distance)) / 2

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.