def swap
import bend-collections-laws-math@1.0.0.0/src/math/random/rand.bend as Randimport Base
277# exchange elements i and j (unchanged when either is out of range)
278def swap(-A: Data, +xs: List<&2, A>, +i: Nat, +j: Nat) -> List<&2, A>:
279 swap_m(A, xs, i, j, nth(A, xs, i), nth(A, xs, j))