my $chosen; my $n = 0; while(my($k, $v) = each %hash) { rand(++$n) < 1 and $chosen = $v; } return $chosen;