Hmm couldn't you make it a lil less messy though?
Add a new user field "randomavatar" with the yes/no code
and a new user field of "maxrandavatar"
Code:
if ($this->post['randomavatar'] == 1) // meaning yes
{
$randomavatar = rand(1,$post['maxrandavatar']);
$this->post['avatarurl'] = "http://yourdomain/forumdirectory/images/avatars/random/$post['userid']/$randomavatar.jpg";
}
Then you'd create a new folder in the avatars folder called "random" and then add new folders of that users userid with the avatars in there.
Course you'd go through the admin users panel to turn it on and set how many images it randomizes through.
That's my input
Awesome idea though, will definately be implementing this in some form for premium members