Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^3: [OT] Stats problem

by syphilis (Bishop)
on Feb 26, 2015 at 14:04 UTC ( #1117954=note: print w/replies, xml ) Need Help??

in reply to Re^2: [OT] Stats problem
in thread [OT] Stats problem

What are the odds of a card ending up in its standard position?

That's easy enough - it's 1 in 52.
A card can be in any one of 52 positions, only one of which is its "standard position" - and there's no bias that favours one position over another.

UPDATE What follows doesn't scale correctly ... it aint right IOW - probably the linkage that salva was getting at.

The chance that none of the cards are in their standard position is simply (51/52) ** 52, which is around 0.3643 or approximately 1 in 3.
Therefore the chance that 1 or more cards are in their standard position is 1 - ((51/52) ** 52) which is around 0.6357 or approximately 2 in 3.
(You could turn this into a rather boring game of patience/solitaire.)

As for what you're actually trying to calculate, I'm still trying ot get my head around it.
(Please stick to cards in future ;-)


Replies are listed 'Best First'.
Re^4: [OT] Stats problem
by Anonymous Monk on Feb 26, 2015 at 15:17 UTC

    Just for fun, a simulation to confirm:

    use List::Util qw/shuffle sum/; my $RUNS = 1_000_000; my %counts; for (1..$RUNS) { my @deck = shuffle 0..51; my $in_correct_loc = grep {$_==$deck[$_]} 0..51; $counts{$in_correct_loc}++; } print "Number of cards in the correct position: % of runs\n"; printf "% 4d: %.4f%%\n", $_, 100*$counts{$_}/$RUNS for sort {$a<=>$b} keys %counts; my $one_or_more = sum map {$_//0} @counts{1..52}; printf "1-52: %.4f%%\n", 100*$one_or_more/$RUNS; __END__ Number of cards in the correct position: % of runs 0: 36.8130% 1: 36.8086% 2: 18.3846% 3: 6.1085% 4: 1.5349% 5: 0.2926% 6: 0.0487% 7: 0.0080% 8: 0.0010% 9: 0.0001% 1-52: 63.1870%

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1117954]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2020-06-06 21:30 GMT
Find Nodes?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?

    Results (41 votes). Check out past polls.