diff options
author | Dominik Picheta <dominikpicheta@googlemail.com> | 2021-02-15 16:56:17 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-15 08:56:17 -0800 |
commit | 00f86f55912fa5f28e19ca06b207d5abd4224c59 (patch) | |
tree | 45ce31d5a6d0af0d04a97102d3da2a61766ad41d /lib/pure | |
parent | 339ebe958dad77caa04c50161a00288da8c3cab3 (diff) | |
download | Nim-00f86f55912fa5f28e19ca06b207d5abd4224c59.tar.gz |
Better error message for rand(153 .. 102) (#17031)
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/random.nim | 2 |
1 files changed, 1 insertions, 1 deletions
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 |