Skip to content

Commit

Permalink
Fix select of a single random element
Browse files Browse the repository at this point in the history
  • Loading branch information
tbody-cfs committed Nov 13, 2023
1 parent 256b94d commit 74b215d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion freegs/optimiser.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ def pickUnique(N, m, e):
inds = sorted(e) # Sorted list of indices. Used to avoid clashes
others = [] # The list of three agents
for i in range(m):
newind = random.randint(0, N - 1 - i - len(e))
high = N - 1 - i - len(e)
newind = random.randint(0, high) if high > 0 else 0

for ind in inds:
if newind == ind:
newind += 1
Expand Down

0 comments on commit 74b215d

Please sign in to comment.