On 10/17/07, Tony Godshall <[EMAIL PROTECTED]> wrote: > On 10/17/07, Tony Godshall <[EMAIL PROTECTED]> wrote: > > On 10/17/07, Micah Cowan <[EMAIL PROTECTED]> wrote: > > > -----BEGIN PGP SIGNED MESSAGE----- > > > Hash: SHA256 > > > > > > Tony Godshall wrote: > > > >> Well, I'm don't have much to say about about the other points but one > > > >> certainly does not need to keep an array for something like this- with > > > >> the classic pseudorandom shuffle algorithm you only need to keep a > > > >> count of the ones visited. Shall I pull out my Knuth? > > > > > > That... only applies if you actually keep a _queue_ around, of all the > > > ports that you plan to try, and shuffle it. Surely that's more waste > > > (65,535 shorts, versus 65,535 _bits_), not less? ...We're not shuffling, > > > here, we're choosing. > > > > No, the point was that with a relative prime or two you can walk in a > > pseudorandom pattern though, hitting each point only once needing no > > array at all. > > > > Donald E. Knuth, The Art of Computer Programming, Volume 2, 3rd > Edition, pp. 17-19
...and probably closer at hand... http://en.wikipedia.org/wiki/Linear_congruential_generator TG