def shuffle
import bend-kit-random@0.1.0.1/random.bend as Randomimport Base
142# A uniform permutation of xs. Every draw is below(i + 1), so a list of n
143# items uses n - 1 draws.
144def shuffle(~T: Data, xs: List<&2, T>, r: Rng) -> List<&2, T> & Rng:
145 match xs:
146 case Nil{}:
147 (Nil{}, r)
148 case Con{+h, t}:
149 shuffle.run(~T, h, h <> t, r)