// TODO: find more triplets for different n sclass TripletLSFR { // params int n; int start = 1; int a, b, c; // the triplet // changing variables int step, value; // triplets mask for different n's (TODO) static final int[] triplesTable = {}; *(int *n, int *a, int *b, int *c) { value = start; } int cycleLength() { ret (1 << n)-1; } int next() { int mask = ((1 << n)-1); step = (step+1) & mask; int x = value; x ^= (x << a) & mask; x ^= x >>> b; x ^= (x << c) & mask; ret value = x; } }