Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (jogarMoeda)
- (cond ((= (random 1) 0) #t)
- (else #f)))
- (write (jogarMoeda))
- (define (monteCarlo func)
- (lambda(totalTrays)
- (define (monteCarlo-simula conta trays)
- (cond ((= trys 0)
- (/ trays totalTrays))
- ((func)
- (monteCarlo-simula (- conta 1)
- (+ trays 1)))
- (else (monteCarlo-simula (- conta 1) trays))))))
- (define testarJogadasMoeda (monteCarlo jogarMoeda))
- (write (testarJogadasMoeda 443))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement