From 56d53bfef61407fe8233635e94d9484c02c18a15 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Wed, 17 Jun 2015 15:57:00 +0200 Subject: [PATCH] bugfix: `CCRandom.float_range` --- src/core/CCRandom.ml | 3 +-- src/core/CCRandom.mli | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/core/CCRandom.ml b/src/core/CCRandom.ml index b4d75504..12d970e1 100644 --- a/src/core/CCRandom.ml +++ b/src/core/CCRandom.ml @@ -70,8 +70,7 @@ let float f st = Random.State.float st f let small_float = float 100.0 -let float_range i j st = i +. Random.State.float st (j-.i+.1.) - +let float_range i j st = i +. Random.State.float st (j-.i) let replicate n g st = let rec aux acc n = diff --git a/src/core/CCRandom.mli b/src/core/CCRandom.mli index 506fca86..05b05c8c 100644 --- a/src/core/CCRandom.mli +++ b/src/core/CCRandom.mli @@ -97,10 +97,9 @@ val float : float -> float t @since 0.6.1 *) val float_range : float -> float -> float t -(** Inclusive range +(** Inclusive range. [float_range a b] assumes [a < b]. @since 0.6.1 *) - val split : int -> (int * int) option t (** Split a positive value [n] into [n1,n2] where [n = n1 + n2]. @return [None] if the value is too small *)