mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-09 12:45:34 -05:00
test for CCArray.shuffle
This commit is contained in:
parent
983b23046c
commit
6ae3e5b283
1 changed files with 5 additions and 0 deletions
|
|
@ -166,6 +166,11 @@ let _shuffle _rand_int a i j =
|
||||||
a.(k) <- tmp;
|
a.(k) <- tmp;
|
||||||
done
|
done
|
||||||
|
|
||||||
|
(*$T
|
||||||
|
let st = Random.State.make [||] in let a = 0--10000 in \
|
||||||
|
let b = Array.copy a in shuffle_with st a; a <> b
|
||||||
|
*)
|
||||||
|
|
||||||
let _choose a i j st =
|
let _choose a i j st =
|
||||||
if i>=j then raise Not_found;
|
if i>=j then raise Not_found;
|
||||||
a.(i+Random.int (j-i))
|
a.(i+Random.int (j-i))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue