Consider the following
function swap(&$a, &$b) { list($a, $b) = array($b, $a); }
$len = count($a);
for($i = 0; $i < $len; $i++) {
$j = rand(1, $len) - 1;
swap($a[$i], $a[$j]);
}
this is a standard loop that moves all the elements of an array. To shuffle only some ("movable") elements, put their keys in an array
$keys = array(1, 3, 5, 7, 9, 11, 13, 17);
and replace the loop over $ a with the loop over $ keys
$len = count($keys);
for($i = 0; $i < $len; $i++) {
$j = rand(1, $len) - 1;
swap($a[$keys[$i]], $a[$keys[$j]]);
}
this moves the elements at positions 1, 3, 5, etc. and leaves other elements in place