testlib icon indicating copy to clipboard operation
testlib copied to clipboard

If seed < 256 for class random, then the first invocation of next() is always 5 modulo 8

Open GoogleCodeExporter opened this issue 10 years ago • 0 comments

Such program

  for (int i = 0; i <= 300; ++i) {
    random rnd;
    rnd.setSeed(i);
    if (rnd.next(8) != 5) {
      cerr << i << endl;
    }
  }

Outputs

256
257
258
...
300

Original issue reported on code.google.com by [email protected] on 5 Dec 2009 at 2:22

GoogleCodeExporter avatar Jun 03 '15 09:06 GoogleCodeExporter