@Test public void testIntAscending() throws Exception { List<int[]> sequences = DataGenerator.sequenceOfAscendingIntegers(5, -10, 10).toList(3); for (int[] seq : sequences) { for (int i = 1; i < seq.length; i++) { assertThat(seq[i - 1] <= seq[i]).isTrue(); } } }
public static DataGenerator<int[]> sequenceOfAscendingIntegers(int size, int lowerBound, int upperBound) { final int range = upperBound - lowerBound; return DataGenerator.fromContext(new Random(), random -> { int[] result = new int[size]; for (int i = 0; i < size; i++) { result[i] = lowerBound + random.nextInt(range); } Arrays.sort(result); return Pair.of(random, result); }); }
SeqNumberDataGenerators { public static DataGenerator<int[]> sequenceOfAscendingIntegers(int size, int lowerBound, int upperBound) { final int range = upperBound - lowerBound; return DataGenerator.fromContext(new Random(), random -> { int[] result = new int[size]; for (int i = 0; i < size; i++) { result[i] = lowerBound + random.nextInt(range); } Arrays.sort(result); return Pair.of(random, result); }); } }
SeqNumberDataGenerators { public static DataGenerator<int[]> sequenceOfAscendingIntegers(int size, int lowerBound, int upperBound) { final int range = upperBound - lowerBound; return DataGenerator.fromContext(new Random(), random -> { int[] result = new int[size]; for (int i = 0; i < size; i++) { result[i] = lowerBound + random.nextInt(range); } Arrays.sort(result); return Pair.of(random, result); }); }  }
SeqNumberDataGenerators { public static DataGenerator<int[]> sequenceOfAscendingIntegers(int size, int lowerBound, int upperBound) { final int range = upperBound - lowerBound; return DataGenerator.fromContext(new Random(), random -> { int[] result = new int[size]; for (int i = 0; i < size; i++) { result[i] = lowerBound + random.nextInt(range); } Arrays.sort(result); return Pair.of(random, result); }); }  static DataGenerator<int[]> sequenceOfAscendingIntegers(int size, int lowerBound, int upperBound); }
SeqNumberDataGenerators { public static DataGenerator<int[]> sequenceOfAscendingIntegers(int size, int lowerBound, int upperBound) { final int range = upperBound - lowerBound; return DataGenerator.fromContext(new Random(), random -> { int[] result = new int[size]; for (int i = 0; i < size; i++) { result[i] = lowerBound + random.nextInt(range); } Arrays.sort(result); return Pair.of(random, result); }); }  static DataGenerator<int[]> sequenceOfAscendingIntegers(int size, int lowerBound, int upperBound);  }