$logoimages = array('theme1_bild1', 'theme1_bild2', 'theme2_bild1', 'theme2_bild2', 'theme2_bild3', 'theme3_bild1', ..., 'themeN_bildK');
$logoimage_theme1 = $logoimages[rand(0, 1)];
$logoimage_theme2 = $logoimages[rand(2, 4)];
$logoimage_theme3 = $logoimages[rand(5, m)];
...
$logoimage_themeN = $logoimages[rand(count($logoimages) - k - 1, count($logoimages) - 1)];