Skip to content

Commit

Permalink
Fix Random seed in TSP tutorial (#2863)
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-foster committed Feb 8, 2022
1 parent 6eb56b1 commit e5f5586
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/src/tutorials/algorithms/tsp_lazy_constraints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ import Plots
# thus, the weight (distance) of each edge is defined as follows.

function generate_distance_matrix(n; random_seed = 1)
Random.seed!(random_seed)
X = 100 * rand(n)
Y = 100 * rand(n)
rng = Random.MersenneTwister(random_seed)
X = 100 * rand(rng, n)
Y = 100 * rand(rng, n)
d = [sqrt((X[i] - X[j])^2 + (Y[i] - Y[j])^2) for i in 1:n, j in 1:n]
return X, Y, d
end
Expand Down

0 comments on commit e5f5586

Please sign in to comment.