@Test public void testCreateNumbersToDistributeWithTwice() { byte[] v = Creator.createNumbersToDistribute(new Random(), 2); List<Integer> intList = Utility.toIntList(v); assertEquals(2*9, intList.size()); assertEquals(Arrays.asList(1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9), intList); }
protected static byte[] createNumbersToDistribute( final Random r, final int multiplicity) { int totalNumbers = GameMatrix.MAXIMUM_VALUE - GameMatrix.MINIMUM_VALUE + 1; List<Integer> numbersToDistribute = new ArrayList<>(totalNumbers * multiplicity); for (int number = GameMatrix.MINIMUM_VALUE; number <= GameMatrix.MAXIMUM_VALUE; number++) { for (int j = 0; j < multiplicity; j++) { numbersToDistribute.add(number); } } Collections.shuffle(numbersToDistribute, r); byte[] numbersToDistributeArray = new byte[numbersToDistribute.size()]; int k = 0; for (Integer number : numbersToDistribute) { numbersToDistributeArray[k++] = number.byteValue(); } return numbersToDistributeArray; }
Creator { protected static byte[] createNumbersToDistribute( final Random r, final int multiplicity) { int totalNumbers = GameMatrix.MAXIMUM_VALUE - GameMatrix.MINIMUM_VALUE + 1; List<Integer> numbersToDistribute = new ArrayList<>(totalNumbers * multiplicity); for (int number = GameMatrix.MINIMUM_VALUE; number <= GameMatrix.MAXIMUM_VALUE; number++) { for (int j = 0; j < multiplicity; j++) { numbersToDistribute.add(number); } } Collections.shuffle(numbersToDistribute, r); byte[] numbersToDistributeArray = new byte[numbersToDistribute.size()]; int k = 0; for (Integer number : numbersToDistribute) { numbersToDistributeArray[k++] = number.byteValue(); } return numbersToDistributeArray; } }
Creator { protected static byte[] createNumbersToDistribute( final Random r, final int multiplicity) { int totalNumbers = GameMatrix.MAXIMUM_VALUE - GameMatrix.MINIMUM_VALUE + 1; List<Integer> numbersToDistribute = new ArrayList<>(totalNumbers * multiplicity); for (int number = GameMatrix.MINIMUM_VALUE; number <= GameMatrix.MAXIMUM_VALUE; number++) { for (int j = 0; j < multiplicity; j++) { numbersToDistribute.add(number); } } Collections.shuffle(numbersToDistribute, r); byte[] numbersToDistributeArray = new byte[numbersToDistribute.size()]; int k = 0; for (Integer number : numbersToDistribute) { numbersToDistributeArray[k++] = number.byteValue(); } return numbersToDistributeArray; } private  Creator(); }
Creator { protected static byte[] createNumbersToDistribute( final Random r, final int multiplicity) { int totalNumbers = GameMatrix.MAXIMUM_VALUE - GameMatrix.MINIMUM_VALUE + 1; List<Integer> numbersToDistribute = new ArrayList<>(totalNumbers * multiplicity); for (int number = GameMatrix.MINIMUM_VALUE; number <= GameMatrix.MAXIMUM_VALUE; number++) { for (int j = 0; j < multiplicity; j++) { numbersToDistribute.add(number); } } Collections.shuffle(numbersToDistribute, r); byte[] numbersToDistributeArray = new byte[numbersToDistribute.size()]; int k = 0; for (Integer number : numbersToDistribute) { numbersToDistributeArray[k++] = number.byteValue(); } return numbersToDistributeArray; } private  Creator(); static GameMatrix createFull(); static GameMatrix createVariant(
            final GameMatrix fullyFilled); static Riddle createRiddle(final GameMatrix fullMatrix); }
Creator { protected static byte[] createNumbersToDistribute( final Random r, final int multiplicity) { int totalNumbers = GameMatrix.MAXIMUM_VALUE - GameMatrix.MINIMUM_VALUE + 1; List<Integer> numbersToDistribute = new ArrayList<>(totalNumbers * multiplicity); for (int number = GameMatrix.MINIMUM_VALUE; number <= GameMatrix.MAXIMUM_VALUE; number++) { for (int j = 0; j < multiplicity; j++) { numbersToDistribute.add(number); } } Collections.shuffle(numbersToDistribute, r); byte[] numbersToDistributeArray = new byte[numbersToDistribute.size()]; int k = 0; for (Integer number : numbersToDistribute) { numbersToDistributeArray[k++] = number.byteValue(); } return numbersToDistributeArray; } private  Creator(); static GameMatrix createFull(); static GameMatrix createVariant(
            final GameMatrix fullyFilled); static Riddle createRiddle(final GameMatrix fullMatrix);  }