I have implemented XORWOW generator given in the paper http://ift.tt/LPnViB in C and got a set of random numbers as output. Below is the snippet of the logic:
uint32_t xorwow() {
static uint64_t x = 123456789, y = 362436069, z = 521288629,
w = 88675123, v = 5783321, d = 6615241;
uint64_t t;
t = (x ^ (x >> 2));
x = y;
y = z;
z = w;
w = v;
v = (v ^ (v << 4)) ^ (t ^ (t << 1));
return (d += 362437) + v;
}
//Marsaglia's paper uses unsigned long as the word type. This has been changed to uint32_t to ensure the word type is an unsigned 32-bit integer.
The output which I got was:
Output:
246875399 3690007200 1264581005 3906711041 1866187943 2481925219 2464530826 2677782455 3653403911 2504343560
Then I tried using the same XORWOW generator using curandCreateGenerator function with CURAND_RNG_PSEUDO_XORWOW as parameter and set the seed value to zero (ie. A value of 0 for seed sets the state to the values of the original published version of the xorwow algorithm). The code that is used is an example given in the cuRAND documentation http://ift.tt/2cD4jyb
The output which I got was:
output : 3179217846 3955638199 167591721 4161663997 3973448494 1917059131 2866113984 472148682 2019573489 2204150021
According to my understanding both the implementation should give the same set of random numbers because its the same logic. But I am getting different; Is my understanding wrong or Is there anything that I missing out ?
Aucun commentaire:
Enregistrer un commentaire