def shuffle
import bend-collections-laws-crypto@1.0.0.0/src/math/random/rand.bend as Randimport Base
import bend-collections-laws-crypto@1.0.0.0/src/math/u64.bend as W
306# Go's Shuffle (Fisher-Yates, from the last index down), for fewer than 2^48
307# elements
308def shuffle(~A: Data, ~S: Data, ~next: S -> W.U64 & S, s: S, +xs: List<&2, A>) -> List<&2, A> & S:
309 shuffle_go(~A, ~S, ~next, Nat.sub(List.length(&2, A, xs), 1n), len64(A, xs), (xs, s))
Uses (8)
Used by (5)
- bend-collections-laws-crypto@1.0.0.0/proofs/math/random/shuffle:shuffle_perm
- bend-collections-laws-crypto@1.0.0.0/src/math/random/rand:perm
- bend-collections-laws-crypto@1.0.0.0/src/crypto/random:shuffle
- bend-collections-laws-crypto@1.0.0.0/proofs/math/random/shuffle:perm_perm
- bend-collections-laws-crypto@1.0.0.0/spec/math/random:Shuffle.permutation