Generating a random number without duplicates on blog comment
Haven't tested this, but I think this should work. Remove your first two lines of code and place the following in your theme's template.php file (replace MYTHEME with the machine name of your theme):

function MYTHEME_preprocess_comment(&amp;$vars){
    $max = 19;
    $numbers =  $_SESSION['MYTHEME_comment_numbers'] ?: range(0, $max);
    shuffle($numbers);
    $vars['number'] = array_pop($numbers);
    $_SESSION['MYTHEME_comment_numbers'] = count($numbers) ? $numbers : range(0, $max);
}

This makes available a $number variable inside your comment.tpl.php file.

Then, replace your last three lines inside comment.tpl.php with:

print "&lt;div id='commenter-picture'&gt;";
print "&lt;img src='member_default_" . $number . ".png' /&gt;";
print "&lt;/div&gt;";


This will remove already used numbers from your $numbers array until there's none left, and then reset to use the full array again.