From bfa5d9adde6a83df0dc799434660526731a91549 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Tue, 19 Feb 2019 18:46:08 -0600 Subject: [PATCH] breaking: make `Array.random_choose` raise invalid_arg instead of not_found --- src/core/CCArray.ml | 2 +- src/core/CCArray.mli | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/CCArray.ml b/src/core/CCArray.ml index 2fa87a7d..947d243c 100644 --- a/src/core/CCArray.ml +++ b/src/core/CCArray.ml @@ -517,7 +517,7 @@ let rec _to_klist a i j () = let random_choose a = let n = Array.length a in - if n = 0 then raise Not_found; + if n = 0 then invalid_arg "Array.random_choose"; fun st -> a.(Random.State.int st n) let random_len n g st = diff --git a/src/core/CCArray.mli b/src/core/CCArray.mli index b5ddb05d..fac51451 100644 --- a/src/core/CCArray.mli +++ b/src/core/CCArray.mli @@ -245,7 +245,7 @@ val shuffle_with : Random.State.t -> 'a t -> unit val random_choose : 'a t -> 'a random_gen (** [random_choose a rs] randomly chooses an element of [a]. - @raise Not_found if the array/slice is empty. *) + @raise Invalid_argument if the array/slice is empty. *) val to_seq : 'a t -> 'a sequence (** [to_seq a] returns a [sequence] of the elements of an array [a].