Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed May 3, 2021
1 parent 52b2473 commit cbae73c
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions lib/pure/random.nim
Original file line number Diff line number Diff line change
Expand Up @@ -343,19 +343,13 @@ proc rand*[T: SomeInteger](t: typedesc[T]): T =
## * `rand proc<#rand,float>`_ that returns a floating point number
## * `rand proc<#rand,HSlice[T: Ordinal or float or float32 or float64,T: Ordinal or float or float32 or float64]>`_
## that accepts a slice
runnableExamples("-r:off"):
runnableExamples:
randomize(567)
# implementation defined
assert rand(int8) == 55
assert rand(int8) == -42
assert rand(int8) == 43
assert rand(uint32) == 578980729'u32
assert rand(uint32) == 4052940463'u32
assert rand(uint32) == 2163872389'u32
assert rand(range[1..16]) == 11
assert rand(range[1..16]) == 4
assert rand(range[1..16]) == 16

if false: # implementation defined
assert rand(int8) == -42
assert rand(uint32) == 578980729'u32
assert rand(range[1..16]) == 11
# pending csources >= 1.4.0, use `runnableExamples("-r:off")` instead (a strang error)
when T is range:
result = rand(state, low(T)..high(T))
else:
Expand Down

0 comments on commit cbae73c

Please sign in to comment.