gscheme/examples/randcircles.scm

18 lines
439 B
Scheme

(define randcircles
(lambda (n rmax lmax)
(let
((x (random lmax)) (y (random lmax))
(fill (random 2))
(radius (+ (/ rmax 2) (random (/ rmax 2)))))
(draw-color
(random 256)
(random 256)
(random 256))
(draw-move x y)
((if (zero? fill) draw-circle fill-circle) radius)
(if (not (zero? n))
(randcircles (- n 1) rmax lmax)))))
(randcircles 25 30 250)