What's the fun if you arrive at the correct solution the first time
46. Java
public static void main(String[] args) { int[] numbers = new int[10]; boolean foundAnswer = false; while(!foundAnswer) { for(int i = 0; i < numbers.length; i++) { numbers[i] =(int)( Math.random() * 10 + 1); } sort(numbers); foundAnswer = true; for(int i = 1; i < numbers.length && foundAnswer; i++) { if(numbers[i-1] == numbers[i]) { foundAnswer = false; } } } System.out.println(numbers); } public static void sort(int[] numbers) { for (int i = 0; i < numbers.length; i++) { int min = 0; for(int j = i; j < numbers.length; j++) { if(numbers[min] > numbers[j]) { min = j; } } int temp = numbers[min]; numbers[min] = numbers[i]; numbers[i] = temp; } }