From 91b96463daa452fb3b9eaaff1a405da62763ee30 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Mon, 7 Aug 2023 15:11:22 +0200 Subject: [PATCH] in-random: Add some explicit type annotations. Used to work without them before Racket 8.9, but hey that's nothing special. --- utils.rkt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/utils.rkt b/utils.rkt index 8faf33d..a9ca75d 100644 --- a/utils.rkt +++ b/utils.rkt @@ -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"