How to write a program to get probability that two cards same number and same color?
古いコメントを表示
I need to write a program to get probability that both two cards are the same number(two cards are selected at random from an ordinary pack of 52 cards ) (1-1, 2-2, ..., 10-10) and the same color (Red-Red, Black-Black).with using a billon random events
回答 (1 件)
Iain
2013 年 5 月 30 日
If you're asking the question:
You take the Ace of spades from a standard 52 card deck, and you want to know the likelihood that you will then draw a black ace (the ace of clubs) from the remaining 51 cards, then the answer is 1 in 51.
Regardless of card, its 1 in 51.
matches = 0;
for i = 1:1e9
if ceil(rand()*51) == 1
matches = matches + 1;
end
end
measured_probability = matches / 1e9;
カテゴリ
ヘルプ センター および File Exchange で QSP, PKPD, and Systems Biology についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!