Advertisement
Guest User

Untitled

a guest
Nov 11th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1.  
  2. (define (jogarMoeda)
  3. (cond ((= (random 1) 0) #t)
  4. (else #f)))
  5.  
  6.  
  7. (write (jogarMoeda))
  8.  
  9.  
  10. (define (monteCarlo func)
  11. (lambda(totalTrays)
  12. (define (monteCarlo-simula conta trays)
  13. (cond ((= trys 0)
  14. (/ trays totalTrays))
  15. ((func)
  16. (monteCarlo-simula (- conta 1)
  17. (+ trays 1)))
  18. (else (monteCarlo-simula (- conta 1) trays))))))
  19.  
  20.  
  21. (define testarJogadasMoeda (monteCarlo jogarMoeda))
  22.  
  23. (write (testarJogadasMoeda 443))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement