Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define GU(G,A) long u_##G(){G=(G*A)%2147483647;return G;}
- #define GU2(G,M) long u_##G##2 (){do{u_##G();}while((G%M)!=0);return G;}
- long a,b;GU(a,16807) GU(b,48271) GU2(a,4) GU2(b,8)
- int j(int iters, long (*ua)(), long (*ub)()){ a=703;b=516;int count = 0;
- for(int i=0;i<iters;i++) count+=((*ua)()&0xFFFF)==((*ub)()&0xFFFF);
- return count;}
- int main(){
- printf("%d\n", j(40000000, &u_a, &u_b));
- printf("%d\n", j(5000000, &u_a2, &u_b2));
- return 0;}
Advertisement
Advertisement
Advertisement
RAW Paste Data
Copied
Advertisement