rand.util: workaround for inaccurate `v` warning in vlib/rand/util/util.v (#10344)

pull/10352/head
Lucas Rodrigues 2021-06-04 11:05:58 -03:00 committed by GitHub
parent f4486d79c3
commit fdc03f70b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -14,8 +14,9 @@ pub fn sample_nr<T>(array []T, k int) []T {
mut results := []T{len: k} mut results := []T{len: k}
mut indices := []int{len: n} mut indices := []int{len: n}
// Initialize with all indices // Initialize with all indices
for i, mut v in indices { // temporary workaround for issue #10343
v = i for i in 0 .. indices.len {
indices[i] = i
} }
shuffle(mut indices, k) shuffle(mut indices, k)
for i in 0 .. k { for i in 0 .. k {