Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Hmm. I looked into this (god knows why, im not a math type at all, nor do I use random numbers for anything serious). My code is as follows:

my $count=1; my %hash; my $last=-1; for (1..1000000) { my $num=int rand 10; if ($num == $last) { $count++; } else { $hash{$last}{$count}++ unless $last<0; $count=1; } $last=$num; } use Data::BFDump; Dump(\%hash)->Out();

Ive run it a few times for various large number of iterations and it does seem like sequences of 0 are just slightly more common than other numbers. I dont have the stats skills currently and I can't be bothered doing the research to find out how to find out how much the deviation is, or if its signifigant. Update: Nah. I did a few more runs, I now dont think there appears to be much difference.

Im hoping tilly or one of the other math types comes in and explains all this for us. :-)

$HASH1 = { 0 => { 1 => 809217, 2 => 80661, 3 => 8105, 4 => 793, 5 => 78, 6 => 14 }, 1 => { 1 => 809964, 2 => 81041, 3 => 7980, 4 => 824, 5 => 90, 6 => 7, 7 => 1 }, 2 => { 1 => 809678, 2 => 81151, 3 => 8134, 4 => 837, 5 => 74, 6 => 4, 7 => 2 }, 3 => { 1 => 810420, 2 => 80495, 3 => 8204, 4 => 809, 5 => 96, 6 => 4, 7 => 2 }, 4 => { 1 => 809280, 2 => 81142, 3 => 8068, 4 => 795, 5 => 72, 6 => 12, 7 => 1 }, 5 => { 1 => 808510, 2 => 81230, 3 => 8157, 4 => 841, 5 => 83, 6 => 9, 7 => 1 }, 6 => { 1 => 811176, 2 => 81502, 3 => 8166, 4 => 817, 5 => 68, 6 => 9 }, 7 => { 1 => 810293, 2 => 80902, 3 => 8071, 4 => 788, 5 => 78, 6 => 11, 7 => 1 }, 8 => { 1 => 809579, 2 => 81208, 3 => 8061, 4 => 837, 5 => 81, 6 => 9, 7 => 1 }, 9 => { 1 => 809785, 2 => 81492, 3 => 8071, 4 => 857, 5 => 83, 6 => 9 } };


---
demerphq

    First they ignore you, then they laugh at you, then they fight you, then you win.
    -- Gandhi



In reply to Re: Random numbers Perl ok! (I think) by demerphq
in thread Random numbers Perl ok! (I think) by liz

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (6)
    As of 2014-07-14 09:00 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      When choosing user names for websites, I prefer to use:








      Results (257 votes), past polls