On the mediawiki.org description, this is written:
It should also be noted that if only one user has uploaded an avatar and no other user has done so, using <randomuserswithavatars> causes a PHP warning about invalid arguments for foreach in the main extension file and no avatars are displayed. For example, if 2 or more users have uploaded an avatar, then this tag will work properly.
I'm just wondering, why not just fix the bug? All you'd have to do is cast to an array on line 55, like so:
$random_keys = (array)array_rand( $files, $count );