Biocaml 0.4-dev : Biocaml_math.shuffle

let shuffle result =
let result = Array.copy result in
for i = Array.length result - 1 downto 0 do
let other = Random.int (i + 1) and tmp = result.(i) in
result.(i) <- result.(other); result.(other) <- tmp
done; result

AltStyle によって変換されたページ (->オリジナル) /