random: Remove redundant checking.
This commit is contained in:
parent
acb7d999ba
commit
740b6dc198
|
@ -112,18 +112,10 @@
|
||||||
(define-values (-random) ; more featureful than #%kernel's `random`
|
(define-values (-random) ; more featureful than #%kernel's `random`
|
||||||
(case-lambda
|
(case-lambda
|
||||||
[() (random)] ; no args, random float
|
[() (random)] ; no args, random float
|
||||||
[(x)
|
[(x) ; one arg, either random float with prng, or random integer
|
||||||
;; one arg, either random float with prng, or random integer
|
;; can just pass through to #%kernel's `random`, which will do the
|
||||||
(cond [(exact-positive-integer? x)
|
;; necessary checking
|
||||||
(enforce-random-int-range x)
|
(random x)]
|
||||||
(random x)]
|
|
||||||
[(pseudo-random-generator? x)
|
|
||||||
(random x)]
|
|
||||||
[else
|
|
||||||
(raise-argument-error
|
|
||||||
'random
|
|
||||||
"(or/c (integer-in 1 4294967087) pseudo-random-generator?)"
|
|
||||||
x)])]
|
|
||||||
[(x y)
|
[(x y)
|
||||||
;; two args, either max and prng, or min and max
|
;; two args, either max and prng, or min and max
|
||||||
(cond [(exact-positive-integer? y) ; min and max case
|
(cond [(exact-positive-integer? y) ; min and max case
|
||||||
|
|
Loading…
Reference in New Issue
Block a user