1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

all: rename it to index in array inits (#17543)

This commit is contained in:
ChAoS_UnItY
2023-03-09 03:51:45 +08:00
committed by GitHub
parent 2597efa7f6
commit ae6a48c0e3
17 changed files with 75 additions and 62 deletions

View File

@ -444,7 +444,7 @@ pub fn (mut rng PRNG) choose[T](array []T, k int) ![]T {
return error('Cannot choose ${k} elements without replacement from a ${n}-element array.')
}
mut results := []T{len: k}
mut indices := []int{len: n, init: it}
mut indices := []int{len: n, init: index}
rng.shuffle[int](mut indices)!
for i in 0 .. k {
results[i] = array[indices[i]]