Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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%

In reply to Re^4: [OT] Stats problem by Anonymous Monk
in thread [OT] Stats problem by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2024-04-18 16:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found