in reply to Re: Random Math Question
in thread Random Math Question

Roy Johnson,
Since the groups themselves are getting shuffled as well, any 1 of the 100K numbers could end up in any position in the entire range. I had considered the selection of the groups each iteration to also be random but didn't think it was worth it. I didn't really think my position was correct.

I could have had the characterization of the problem wrong as I did come in on the tail end of it. My understanding was that you already had a list of 100K numbers and you needed to randomize the order. In this case, the numbers themselves don't matter just their positions. My process would be to apply the Fisher-Yates shuffle many times but on different scales. Sometimes using chunks of the list as though they were single elements and sometimes as though each chunk were the entire list.

Cheers - L~R

Replies are listed 'Best First'.
Re^3: Random Math Question
by BrowserUk (Patriarch) on Oct 10, 2005 at 23:59 UTC

    Although any number can end up in any position, without something to break up the groups between repetitions, the groups of numbers will remain grouped:


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
      Just to elaborate on what BrowserUK said — It isn't enough for any given number to have an equal probability of ending up in any position. It has to have an equal probability of ending up in any position irrespective of the positions of any other numbers. Clearly, under this algorithm, the number 1 will never be more than b-1 places away from 2 (where b is the block size). (In fact the constraint is tighter than that, but that's enough description to make the point.)