# A Random Player

A Random Player Mercutio Thu, 2011-05-05 23:31This is perhaps a fairly simple thing, but does have a semi-decent amount of use on games:

Out of all the players on your game, pick one. That's it. Just pick one player, but do it /at random/.

One way of doing this is as follows:

lsearch(all,type,players,start,rand(nlsearch(all,type,players)),count,1)

It works on the logic that nlsearch() knows how many players there are, and get a random value based on that.

For the lsearch, we then start at the dbref-count that it gives, and grab just 'one value' from that number on. Aka, that very same dbref. This requires that other restrictions, like - checking if they have an approved flag, must be done within /both/ searches.

**How would you do this?**