From 00f86f55912fa5f28e19ca06b207d5abd4224c59 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Mon, 15 Feb 2021 16:56:17 +0000 Subject: Better error message for rand(153 .. 102) (#17031) Co-authored-by: Andreas Rumpf --- lib/pure/random.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/pure/random.nim b/lib/pure/random.nim index f7f0f457d..f91d92731 100644 --- a/lib/pure/random.nim +++ b/lib/pure/random.nim @@ -309,7 +309,7 @@ proc rand*[T: Ordinal or SomeFloat](r: var Rand; x: HSlice[T, T]): T = doAssert r.rand(1..6) == 4 doAssert r.rand(1..6) == 6 let f = r.rand(-1.0 .. 1.0) # 0.8741183448756229 - + assert x.a <= x.b when T is SomeFloat: result = rand(r, x.b - x.a) + x.a else: # Integers and Enum types -- cgit 1.4.1-2-gfad0