let shuffle ?prng array = let random_int = match prng with | None -> Random.int | Some state -> Random.State.int state in for i=1 to Array.length array -1 do swap array (random_int (succ i)) i done