Scheme (Racket) Getting a random boolean with probably 0 < p < 1 -


in racket scheme, best way random boolean true probability 0 <= p <= 1?

here solution, make probabilities explicit:

#lang racket (require math) (define d (discrete-dist '(#t #f) '(0.6 0.4))) (sample d 10) 

sample output:

'(#f #t #t #t #t #f #t #f #f #t) 

Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -