Don't ask to ask, just ask | |
PerlMonks |
Re: removing the gotoby TilRMan (Friar) |
on Jun 03, 2007 at 06:05 UTC ( [id://618960]=note: print w/replies, xml ) | Need Help?? |
redo LABEL is the answer to your question, but here are a couple of "better" ways to select $maxclients unique elements from a bag (@weighteddiv). This approach has the advantage of being simple, but it is relatively slow for large datasets and does not preserve the order in which the numbers were picked:
You can preserve the order with a little more code in the loop to create @selected incrementally:
Finally, a complicated but efficient solution involving probabilities:
Caveat: All solutions untested.
In Section
Seekers of Perl Wisdom
|
|