[ create a new paste ] login | about

Link: http://codepad.org/E1r5ljef    [ raw code | output | fork ]

C, pasted on Nov 14:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
unsigned int xorshift() {
static unsigned int t, x=123456789UL,y=362436069UL,z=521288629UL,w=88675123UL;
t=x^(x<<11); x=y; y=z; z=w; return w^=(w>>19)^t^(t>>8); 
return t;
}

#include <stdio.h>
int main(vod){
unsigned long long cycle=0;
int t=xorshift(),tt;
while((tt=xorshift())!=t){
cycle++;
t=tt;
}
printf("cycle=%lld%c",cycle,10);
return 0;
}


Output:
1
Timeout


Create a new paste based on this one


Comments: