Skip to content

Commit

Permalink
Better error message for rand(153 .. 102) (nim-lang#17031)
Browse files Browse the repository at this point in the history
Co-authored-by: Andreas Rumpf <[email protected]>
  • Loading branch information
dom96 and Araq authored Feb 15, 2021
1 parent 339ebe9 commit 00f86f5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/pure/random.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 00f86f5

Please sign in to comment.