// Allows to vary the order by supplying a seed // // We add the seed to every LSFR value generated, and also start // the LSFR with the seed. // Not 100% sure if this works, there was an endless loop once sclass WeightlessShuffledIteratorWithSeed extends WeightlessShuffledIterator { final int offset; // initialize only with a length (and a pseudo-list) // if you are going to be calling nextIndex() instead of next() *(int n) { this((L) iotaZeroList(n)); } *(int n, int seed) { this((L) iotaZeroList(n), seed); } *(L list) { this(list, 0); } *(L list, int seed) { super(list); if (n == 0) ret with offset = 0; lsfr_start(seed); offset = value-1; } // copied from TripletLSFR.start void lsfr_start(int seed) { value = mod_31bit(seed, cycleLength)+1; } int postProcessLSFRValue(int i) { i += offset; ret i >= cycleLength ? i-cycleLength : i; } }