Hi: > On 03 Apr 2015, at 17:44, Eliot Miranda <eliot.mira...@gmail.com> wrote: > > seed := ((seed + 16r7ed55d16) + (seed << 12)) & 16rffffffff. > seed := ((seed ^ 16rc761c23c) ^ (seed as32BitSignedValue >>> 19)) & > 16rffffffff. > seed := ((seed + 16r165667b1) + (seed << 5)) & 16rffffffff. > seed := ((seed + 16rd3a2646c) ^ (seed << 9)) & 16rffffffff. > seed := ((seed + 16rfd7046c5) + (seed << 3)) & 16rffffffff. > seed := ((seed ^ 16rb55a4f09) ^ (seed as32BitSignedValue >>> 16)) & > 16rffffffff. > ^ seed as32BitSignedValue
Ok, my implementation looks now like this: random "Robert Jenkins' 32 bit integer hash function." seed := ((seed + 16r7ed55d16) + (seed << 12)). seed := ((seed bitXor: 16rc761c23c) bitXor: ((seed bitAnd: 16rffffffff) >> 19)). seed := ((seed + 16r165667B1) + (seed << 5)). seed := ((seed + 16rd3a2646c) bitXor: (seed << 9)). seed := ((seed + 16rfd7046c5) + (seed << 3)). seed := self as32BitSigned: ((seed bitXor: 16rb55a4f09) bitXor: ((seed bitAnd: 16rffffffff) >> 16)). ^ seed as32BitSigned: val | r | r := val bitAnd: 16rffffffff. (r bitAnd: 16r80000000) = 0 ifTrue: [ ^ r ]. ^ (16r100000000 - r) * -1 The #as32BitSigned: looks a little naive, but didn’t have any better idea. And Andres, the random number generator is a given, I can’t just change it. Best regards Stefan -- Stefan Marr INRIA Lille - Nord Europe http://stefan-marr.de/research/