random: Get the right name without run-time overhead.
This commit is contained in:
parent
4509430063
commit
cc79e2241c
|
@ -112,7 +112,7 @@
|
||||||
y))))
|
y))))
|
||||||
(begin-encourage-inline
|
(begin-encourage-inline
|
||||||
(define-values (-random) ; more featureful than #%kernel's `random`
|
(define-values (-random) ; more featureful than #%kernel's `random`
|
||||||
(procedure-rename
|
(let ([random ; to get the right name
|
||||||
(case-lambda
|
(case-lambda
|
||||||
[() (random)] ; no args, random float
|
[() (random)] ; no args, random float
|
||||||
[(x) ; one arg, either random float with prng, or random integer
|
[(x) ; one arg, either random float with prng, or random integer
|
||||||
|
@ -140,8 +140,8 @@
|
||||||
(enforce-greater min max)
|
(enforce-greater min max)
|
||||||
(unless (pseudo-random-generator? prng)
|
(unless (pseudo-random-generator? prng)
|
||||||
(raise-argument-error 'random "pseudo-random-generator?" prng))
|
(raise-argument-error 'random "pseudo-random-generator?" prng))
|
||||||
(+ min (random (- max min) prng))])
|
(+ min (random (- max min) prng))])])
|
||||||
'random)))
|
random)))
|
||||||
|
|
||||||
(define-values (new:collection-path)
|
(define-values (new:collection-path)
|
||||||
(let ([collection-path (new-lambda (collection
|
(let ([collection-path (new-lambda (collection
|
||||||
|
|
Loading…
Reference in New Issue
Block a user