Because I'm bored, gonna run through the iterations on the old random generator and show why it's not a random pick. Random means there should be an equal chance for all players involved:
count = 0;
for(vch = mob->in_room->first_person; vch; vch = vch->next_in_room)
if(!IS_NPC(vch) && can_see(mob, vch))
{
if(number_range(0, count) == 0)
rndm = vch;
count++;
}
We'll use 5 players for this.
Player A
Player B
Player C
Player D
Player E
For the sake of argument, 0 is not returned for any of these iterations, which is increasingly likely with the more players this particular code loops through. The only "true" randomness to this generator is if only 2 players are in the room and no more.
First iteration of loop, Player A is seen with a 100% chance on the number_range(0, 0) == 0. Player A is now rndm.
Second iteration of loop, Player A is seen with a 50% chance on the number_range(0, 1) == 0...keep in mind, Player A is already set to rndm, so Player B is the one that has the 50% chance of being rndm, not Player A.
Third iteration of loop, Player A is seen with a 66.6% chance on the number_range(0, 2) == 0. This is because the only way Player A would NOT be picked, is if Player C happens to get that 33.3% chance of a 0. By the way, Player B is not even an option here.
Fourth iteration of loop, Player A is seen with a 75% chance on the number_range(0, 3) == 0. This is because the only way Player A would NOT be picked, is if Player D happens to get that 25% chance of a 0. By the way, Player B and Player C are not even an option here.
Fifth, and final, iteration of the loop, Player A is seen with an 80% chance on the number_range(0, 4) == 0. This is because the only way Player A would NOT be picked, is if Player E happens to get that 20% chance of 0. By the way, Player B, Player C and Player D are not even an option here.
So, as we can see, with the more people that show up on the previous randomly generated code, it's heavily biased to the first person picked, and becomes even more so once 3 or more people are added into the loop.