Skip to content

Commit

Permalink
different rng approach
Browse files Browse the repository at this point in the history
  • Loading branch information
RuneChristensen-NN committed Dec 16, 2024
1 parent 095c017 commit dff0c73
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions ProcessOptimizer/samplers/doe/optimal_design.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ def hit_and_run(x0, constraint_matrix, bounds, n_samples, thin=1, seed=None):

if seed:
#np.random.seed(seed)
#rng = np.random.RandomState(seed)
rng = np.random.default_rng(seed)
rng = np.random.RandomState(seed)
rng2 = np.random.RandomState(seed)
#rng = np.random.default_rng(seed)
else:
#rng = np.random.RandomState()
rng = np.random.default_rng()
rng = np.random.RandomState()
rng2 = np.random.RandomState()
#rng = np.random.default_rng()
#np.random.RandomState(seed)
#np.random.default_rng(seed)

Expand All @@ -58,7 +60,7 @@ def hit_and_run(x0, constraint_matrix, bounds, n_samples, thin=1, seed=None):
t_high = np.min(intersections[denom > 0])

#u = np.random.uniform(0, 1)
u = rng.uniform(0, 1)
u = rng2.uniform(0, 1)
random_distance = t_low + u * (t_high - t_low)
x_new = x + random_distance * random_dir

Expand Down

0 comments on commit dff0c73

Please sign in to comment.