Atfer 5000 runs of 1/2 billion checks per run; the result is:

... Run: 2000 buks:231 stds:273 ... Run: 3000 buks:346 stds:393 ... Run: 4000 buks:466 stds:520 ... Run: 5000 buks:577 stds:663 Run: 5001 buks:578 stds:664 Run: 5002 buks:579 stds:664 Run: 5003 buks:579 stds:664 Run: 5004 buks:579 stds:665

So the odds are:

5000 * 536870912 = 2684354560000 total checks / false hits = odds of a false hit / 579 = 4636190949 offset / 665 = 4036623398 0xdeadbeef Expected odds = 4294967296

Which mean you are right!

However, as the statistics above reflect, and as I observed from several (very) short runs whilst sanity checking the code; the offset seems to beat the odds every time; whilst the fixed magic number seems to come a little shy of it every time.

There are not enough observations and not a sufficiently big difference between them to conclude that this is anything other than expected variation. But it does seem consistent.

I've started another (low priority) run with some sanity check code enabled that counts the occurrences of each random value seen. The extra code means it runs much more slowly; and the restrictions of my physical memory mean I've had to limit the counts to unsigned bytes; but by outputting when those counts rollover it should give a clear indication of whether all values are being generated, as 96 % of them should rollover within a few dozen runs of each other -- if my calculations are correct I should see the bulk of them at around 1024 runs mark.

All of which goes to reinforce my long standing observation that -- for me -- statistics is the second most unintuitive thing -- after quantum mechanics -- that I know just-enough-to-be-dangerous about.

At least with QM I'm in good company when it comes to finding it spooky :)


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked

In reply to Re^4: [OT] Stats problem by BrowserUk
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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.