"Moi" <(E-Mail Removed)> wrote in message

news:69aee$4b4505ac$5350c024$(E-Mail Removed) abel.net...

> On Wed, 06 Jan 2010 14:10:33 -0700, BGB / cr88192 wrote:

>

>> "remod" <(E-Mail Removed)> wrote in message

>> news:4b44f637$0$1119$(E-Mail Removed). ..

>>> Richard Harter ha scritto:

>

>> I have usually implemented the step-hopping via a small PRNG

>> (pseudo-random number generator).

>> the PRNG is usually a fairly simple expression: key1=key*prime;

>

>

> odd * odd -->> odd

> odd * even -->> even

> even * even --> even

>

> Now consider what happens when your prime is odd (which is very likely

>
I often do a right shift as well (to key the slot index).

so, if my prime is 4093, I often use >>12.

however, if the prime is mersenne, it seems to be better not to shift.

this basic strategy was grabbed from 'rand()', and in general seems to have

fairly good distribution properties.

>

>> which can them be masked (or shifted and masked, depending on the prime

>> chosen, ...) to get the hash-spot.

>>

>> IME this usually works fairly well...

>>

>>

>> oddly, I have never heard of anyone else doing this.

>

> Maybe there is a reason for that.

>
dunno...

most people "seem" to be a lot of funkiness with xor, but in my tests the

statistical distribution tends to be worse with these xor based tricks, and

also there does not seem to be much speed difference between an integer

multiply and an xor.

> AvK