Let's say I have a hash with 1 million keys. (no kidding... my system's RAM is pretty full!) I want to pick one key at random. And it needs to be efficient, so I can't just load all the keys into an array and pick a random array element. Any ideas?
2007-02-13
13:21:23
·
4 answers
·
asked by
Wolf Harper
6
in
Computers & Internet
➔ Programming & Design
I prefer to avoid modules because, you never know how they'll work internally. They are likely to do operations which are expensive when done on 1 million keys. It's in RAM for performance; being diskbound to ties or DBMs would bring it to its knees.
And please no rude, smarty-pants answers from know-it-all wannabees who, sadly, don't know it all...
2007-02-13
16:45:11 ·
update #1