From 6ae3e5b2833771844201b603b3c0f67b2f4671ec Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Thu, 26 Jun 2014 21:55:20 +0200 Subject: [PATCH] test for CCArray.shuffle --- core/CCArray.ml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/CCArray.ml b/core/CCArray.ml index 53ee7fba..49bfdd6c 100644 --- a/core/CCArray.ml +++ b/core/CCArray.ml @@ -166,6 +166,11 @@ let _shuffle _rand_int a i j = a.(k) <- tmp; 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 = if i>=j then raise Not_found; a.(i+Random.int (j-i))