mirror of
https://github.com/osmarks/random-stuff
synced 2024-11-09 22:09:55 +00:00
15 lines
420 B
Scheme
15 lines
420 B
Scheme
(define count-zeros
|
|
(lambda (x) (if (= (random 50) 48) (count-zeros (+ 1 x)) x)))
|
|
(define try-sequentially (lambda (x max)
|
|
(random-seed x)
|
|
(let ((zeros (count-zeros 0))) (if (> zeros max)
|
|
(begin
|
|
(display "s=")
|
|
(display x)
|
|
(display ", r=")
|
|
(display zeros)
|
|
(newline)
|
|
(try-sequentially (+ 1 x) zeros))
|
|
(try-sequentially (+ 1 x) max)))))
|
|
(try-sequentially 1 0)
|
|
(exit) |