mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
more doc and test for CCRandom
This commit is contained in:
parent
dba88f5302
commit
2f196ee9a2
2 changed files with 9 additions and 1 deletions
|
|
@ -118,6 +118,13 @@ let split_list i ~len st =
|
||||||
else
|
else
|
||||||
None
|
None
|
||||||
|
|
||||||
|
(*$Q
|
||||||
|
Q.(pair small_int small_int) (fun (i,j) -> \
|
||||||
|
let len, n = min i j, max i j in \
|
||||||
|
let l = QCheck.Gen.generate1 (split_list n ~len) in \
|
||||||
|
match l with None -> true | Some l -> l<> [] && List.for_all (fun x->x>0) l)
|
||||||
|
*)
|
||||||
|
|
||||||
let retry ?(max=10) g st =
|
let retry ?(max=10) g st =
|
||||||
let rec aux n =
|
let rec aux n =
|
||||||
match g st with
|
match g st with
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,8 @@ val split : int -> (int * int) option t
|
||||||
|
|
||||||
val split_list : int -> len:int -> int list option t
|
val split_list : int -> len:int -> int list option t
|
||||||
(** Split a value [n] into a list of values whose sum is [n]
|
(** Split a value [n] into a list of values whose sum is [n]
|
||||||
and whose length is [length].
|
and whose length is [length]. The list is never empty and does not
|
||||||
|
contain [0].
|
||||||
@return [None] if the value is too small *)
|
@return [None] if the value is too small *)
|
||||||
|
|
||||||
val retry : ?max:int -> 'a option t -> 'a option t
|
val retry : ?max:int -> 'a option t -> 'a option t
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue