in reply to •Re: selecting random key from hash
in thread selecting random key from hash

Homework? I haven't had homework in almost 15 years.

I didn't know it was the most efficient way. That's one of the reasons I asked the question. With the types of programs I typically write, I 1) use hashes store data in complex data structures and 2) have to randomly select data from the hash.

I have always used the method I described in my post, but have been curious if there are other ways it could be done. (I started using Perl about a year ago, but not on a regular basis until about 5 months ago. So it is still pretty new to me).

If the method I am using is the most efficient, then great. I will continue to use it.

Thank you all for the input.
davidj