- shuffle: documentation ( source)
- printf: documentation ( source)
<?php
$kat_list=array(1,2,3,4);
shuffle($kat_list); // shuffle list
$count=3;
for($i=0; $i<$count; ++$i) {
// get the first N items of the shuffled list
printf("%d ", $kat_list[$i]);
}