Skip to content

Commit

Permalink
fix: RandomSubSlice
Browse files Browse the repository at this point in the history
  • Loading branch information
manu0466 committed Dec 11, 2024
1 parent 5e805a1 commit 30da3d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions testutils/simtesting/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ func RandomSubSlice[T any](r *rand.Rand, items []T) []T {

var elements []T
// Randomly select how many items to pick
count := r.Intn(len(items))
for i := 0; i < count; i++ {
count := r.Intn(len(items) + 1)
for len(pickedIndexes) < count {
// Get a random index
index := r.Intn(len(items))
_, found := pickedIndexes[index]
Expand Down

0 comments on commit 30da3d5

Please sign in to comment.