use `rng.shuffle(mut indices) ?` again
parent
b4af04259d
commit
15ca57c3de
|
|
@ -328,7 +328,7 @@ pub fn (mut rng PRNG) choose<T>(array []T, k int) ?[]T {
|
||||||
mut results := []T{len: k}
|
mut results := []T{len: k}
|
||||||
mut indices := []int{len: n, init: it}
|
mut indices := []int{len: n, init: it}
|
||||||
// enfoce the type to int to avoid ambiguity
|
// enfoce the type to int to avoid ambiguity
|
||||||
rng.shuffle<int>(mut indices) ?
|
rng.shuffle(mut indices) ?
|
||||||
for i in 0 .. k {
|
for i in 0 .. k {
|
||||||
results[i] = array[indices[i]]
|
results[i] = array[indices[i]]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue