Re: looking for random array reshuffling algorithm

From: Rick D. (nomail_at_mail.com)
Date: 03/20/05


Date: Sun, 20 Mar 2005 21:58:23 +0100

On Sun, 20 Mar 2005 15:38:58 +0000 (UTC), Willem <willem@stack.nl>
wrote:

-snip-

>) A simple (not so random) example:
>)
>) n = 1,2,3,4
>) n+1 = 2,3,4,1
>) n+2 = 3,4,1,2
>) n+3 = 4,1,2,3
>) n+x = .. (loop)
>
>Let me get this correct: You want a single permutation that you can apply
>to an array to get different states, and you want it's period to be as long
>as possible ?

Yes, i'm looking for a fast algorithm that can generate n+1,n+2,..
based on n and reverse it back to n (1 step at a time) and is as
chaotic as possible and has a very big cycle period.

>Or do you want to apply different shuffles every time, and just want them
>to be reversible ?
>
>) I've tried several number regrouping methods. But even when i
>) introduce a random seed to make the process more chaotic they tend to
>) loop (return to the n state) after +/- x=60000 when i use a 20 number
>) array. Which is fast if you consider the fact that there are +/- 20!
>) (=20*19*18*..) possible combinations.
>
>Does it return to the n state exactly, or does it return to one of the
>60000 previous states ?

Right now. After a fixed number of states the process cycles back to
the original state and starts the same cycle again, and again, etc.

I can probably create a somewhat bigger cycle by further adjusting the
seed, but i'm sure there are better and easier ways to do this.

Best regards,
Rick

BTW: To avoid any further confusion i might have caused. With random
shuffling, i mean chaotic shuffling (like a prng), not truly random .
I figured the reversible aspect made that clear, but i guess i should
have been more clear.



Relevant Pages

  • Re: My friend asks a question
    ... Say you had a 2 CYCLE motorcycle and you wanted to push start ... Instead you depressed the clutch lever and put ... WILL THE BIKE START WITH THE ENGINE RUNNINGBACKWARDS??!? ... old outboard that had no reverse. ...
    (rec.crafts.metalworking)
  • Re: alternating-polarity Amplitude-Modulated tone?
    ... The part I am stuck on is how to get the phase to reverse after each ... cycle of the AM envelope. ... carrier frequency 1000 Hz ... how to get the initial phase of both frequencies to be zero? ...
    (comp.dsp)
  • Re: Sagnac Threads United
    ... at different frequencies in the forwards and reverse ... A photon goes through one 'cycle' when it traverses a distance equal to one of ... What you have to realise is that the startpoint of each cycle moves with the ... 'wavelengths' in each path. ...
    (sci.physics.relativity)
  • Re: Sagnac Threads United
    ... at different frequencies in the forwards and reverse ... What you have to realise is that the startpoint of each cycle moves with the ... 'wavelengths' in each path. ... I stated that "startpoint of each cycle moves with the source". ...
    (sci.physics.relativity)