It shouldn't matter if there are repeats or not if there is a uniform bias in the random number generator. However most pseudo-random number generators fail this criteria (ones in practice, in theory they often pass :) ).

What I was proposing you use are sometimes called quasi-random numbers. This is because they are not really too random at all. They have a heavy bias against being chosen twice. The advantage here is that you converge faster. Additionally in the real world they will be more likely to be correct (since any unatural skew in the bias would have to be tempered with the non-repeating bias).

The reason it converges faster is because the numbers chosen are forced to not repeat, but still spread themselves evenly through a given space. I hope you can see why this would converge more quickly -- it's a tad hard to draw an ascii picture to represent this.

Basically it's like using an iteratively increasing grid (like my last post), but then you do not have to commit to any particular number of samples (with the grid, you have to do 4 the first iteration, then 5 more the next, then 10 the next, etc).

I have to be off to work, but as an example here is a base two Hamilton sequence: 0.0, 0.1, 0.01, 0.11, 0.001, 0.101, 0.011, and 0.111 . You may want to convert these numbers into decimal so you can see the sequence: 0.000, 0.500, 0.250, 0.750, 0.125, 0.625, 0.375, 0.875 . Normally, you would use a higher base (which works best when the base is also a prime number), but using 2 lets you see how it is slowly filling up a grid for you. Sobol sequences produce more random results than Hamilton, so using them is more ideal. But anyway, you get the picture.

Ciao,
Gryn


In reply to Pseudo-Random vs. Quasi-Random by gryng
in thread Pi calculator by Fingo

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.