mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-15 15:44:14 +00:00
Better error message for rand(153 .. 102) (#17031)
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user