static int[] randomSortedIntArray(int n, Randomizer random) { new IntBuffer buf; for i to n: if (tossCoin(random)) buf.add(i+1); int[] a = buf.toArray(); }