in-random: Add some explicit type annotations.

Used to work without them before Racket 8.9, but hey that's
nothing special.
This commit is contained in:
Sergiu Ivanov 2023-08-07 15:11:22 +02:00
parent f0a20646ef
commit 91b96463da

View file

@ -561,9 +561,15 @@
(-> Integer Integer (Sequenceof Nonnegative-Fixnum))))
(define in-random
(case-lambda
[() (stream-cons (random) (in-random))]
[(k) (stream-cons (random k) (in-random k))]
[(min max) (stream-cons (random min max) (in-random min max))]))
[() (stream-cons
(assert-type (random) Flonum)
(in-random))]
[(k) (stream-cons
(assert-type (random k) Nonnegative-Fixnum)
(in-random k))]
[(min max) (stream-cons
(assert-type (random min max) Nonnegative-Fixnum)
(in-random min max))]))
(module+ test
(test-case "in-random"