Random header image but also specific header for certain pages

Try this:

<?php
    function array_random($arr, $num = 1) {
        shuffle($arr);
        $r = array();
        for ($i = 0; $i < $num; $i++) {
            $r[] = $arr[$i];
        }
        return $num == 1 ? $r[0] : $r;
    }

    $a = array('vallelogo.png', 'img2.png');
    echo '/img/' . array_random($a);
?>