- . , , Shuffle Fisher-Yates , .
( ). , , , .
. , , 1 9 .
(unshuffled) list {1,2,3,4,5,6,7,8,9} ( 9, ) ( 0 8 , , , Java). , , 4.
4 ( 5) _last (9) , . {1,2,3,4,9,6,7,8} 8.
, , ( 0 7 ). 1.
1 2, , , {1,8,3,4,9,6,7} 7.
, , 7, 4. 9, , {1,8,3,4,7,6} 6.
You must be able to see how this develops. Without any worries about sorting the entire list ahead, you can get a random sequence (well, as happens in random order, as the random number generator allows) without repetition.