fork download
  1. #include <stdio.h>
  2.  
  3. int lcg(int a, int c, int m, int x) {
  4. return x ^ 1;
  5. }
  6.  
  7. int main(void) {
  8. int i, x = 1, a = 1, c = 1, m = 2;
  9. for(i=0; i<20; i++)
  10. printf("%u\n", x = lcg(c, a, m, x));
  11. return 0;
  12. }
Success #stdin #stdout 0s 2052KB
stdin
Standard input is empty
stdout
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1