mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
rand.util: workaround for inaccurate v
warning in vlib/rand/util/util.v (#10344)
This commit is contained in:
parent
f4486d79c3
commit
fdc03f70b5
@ -14,8 +14,9 @@ pub fn sample_nr<T>(array []T, k int) []T {
|
||||
mut results := []T{len: k}
|
||||
mut indices := []int{len: n}
|
||||
// Initialize with all indices
|
||||
for i, mut v in indices {
|
||||
v = i
|
||||
// temporary workaround for issue #10343
|
||||
for i in 0 .. indices.len {
|
||||
indices[i] = i
|
||||
}
|
||||
shuffle(mut indices, k)
|
||||
for i in 0 .. k {
|
||||
|
Loading…
Reference in New Issue
Block a user