Here's an excerpt from a post about the MWCG PRNG.

* [Marsaglia]
* The essence of a version in C requires only [some mods by SJS below]:
*   unsigned long mwcg() {
*     static unsigned long x, y;        /* x, y are 32-bit integers */
*     /* need some initialization code: if first time, init x, y */
*     x=a*(x&65535)+(x>>16);
*     y=b*(y&65535)+(y>>16);
*     return ((x<<16)+(y&65535));       /* return 32-bit value */
*   }

I'm doing two 32x32's rather than 2 16x16's but the principle is the
same.

My question is : what would be the effect of swapping the (x>>16) and
(y>>16) elements? My instinct says mixing the x and y halves is good but
maybe I'm mistaken. 

Mike

Reply via email to