/* Card draw problem in Picat. https://www.reddit.com/r/Probability/comments/1gbm4d0/card_draw_problem/ """ I have 100 unique cards. Lets call them card1, card2, card3... etc. If i draw 40 cards from the deck what is the chance of me having both card1 and card2 in my hand? I asked chatgpt and it said 3.8% but my gut feeling tells me thats way too low. Can somone help me out here or is it really 3.8%? """ Cf my Gamble model gamble_card_draw_problem.rkt This program was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import ppl_distributions, ppl_utils. import util. % import ordset. main => go. /* var : p Probabilities: false: 0.8420500000000000 true: 0.1579500000000000 mean = 0.15795 */ go ?=> reset_store, run_model(20_000,$model,[show_probs_trunc,mean % , % show_simple_stats % , % show_percentiles, % show_hpd_intervals,hpd_intervals=[0.84,0.9,0.94,0.99,0.99999], % show_histogram, % min_accepted_samples=1000,show_accepted_samples=true ]), nl, % show_store_lengths,nl, % fail, nl. go => true. model() => N = 100, M = 40, X = take(shuffle(1..N),M), P = cond((membchk(1,X), membchk(2,X)),true,false), add("p",P).