Skip to content

Commit 1332c7b

Browse files
committed
Fix single-crossing
1 parent af902d8 commit 1332c7b

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

prefsampling/ordinal/singlecrossing.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,9 @@ def single_crossing(
134134
new_line[swap_indices[1]] = domain[line - 1][swap_indices[0]]
135135
domain.append(new_line)
136136

137-
votes = []
138-
last_sampled_index = 0
139-
votes.append(domain[0])
140-
for i in range(1, num_voters):
141-
index = rng.integers(last_sampled_index, domain_size)
142-
votes.append(domain[index])
143-
last_sampled_index = index
137+
indeces = rng.integers(0, domain_size, num_voters)
138+
indeces.sort()
139+
votes = [domain[index] for index in indeces]
144140

145141
return votes
146142

0 commit comments

Comments
 (0)