public static long doubleSchrage(long ix) { return schrageRandomInt(schrageRandomInt(ix)); }
public static long doubleSchrage(long ix) { return schrageRandomInt(schrageRandomInt(ix)); }
@Test public void pseudoRandomTest() { // first 50 iterations final long[] testSuiteResults = {0, 16807, 282475249, 1622650073, 984943658, 1144108930, 470211272, 101027544, 1457850878, 1458777923, 2007237709, 823564440, 1115438165, 1784484492, 74243042, 114807987, 1137522503, 1441282327, 16531729, 823378840, 143542612, 896544303, 1474833169, 1264817709, 1998097157, 1817129560, 1131570933, 197493099, 1404280278, 893351816, 1505795335, 1954899097, 1636807826, 563613512, 101929267, 1580723810, 704877633, 1358580979, 1624379149, 2128236579, 784558821, 530511967, 2110010672, 1551901393, 1617819336, 1399125485, 156091745, 1356425228, 1899894091, 585640194}; long seed = 0; for (int i = 0; i < 50; i++) { long new_seed = testSuiteResults[i]; assertWithMessage("pseudo random mismatch").that(schrageRandomInt(seed)).isEqualTo(new_seed); if (new_seed == 0) new_seed++; seed = new_seed; } }
@Test public void pseudoRandomTest() { // first 50 iterations final long[] testSuiteResults = {0, 16807, 282475249, 1622650073, 984943658, 1144108930, 470211272, 101027544, 1457850878, 1458777923, 2007237709, 823564440, 1115438165, 1784484492, 74243042, 114807987, 1137522503, 1441282327, 16531729, 823378840, 143542612, 896544303, 1474833169, 1264817709, 1998097157, 1817129560, 1131570933, 197493099, 1404280278, 893351816, 1505795335, 1954899097, 1636807826, 563613512, 101929267, 1580723810, 704877633, 1358580979, 1624379149, 2128236579, 784558821, 530511967, 2110010672, 1551901393, 1617819336, 1399125485, 156091745, 1356425228, 1899894091, 585640194}; long seed = 0; for (int i = 0; i < 50; i++) { long new_seed = testSuiteResults[i]; assertWithMessage("pseudo random mismatch").that(schrageRandomInt(seed)).isEqualTo(new_seed); if (new_seed == 0) new_seed++; seed = new_seed; } }