Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: biased random number picking

by salva (Abbot)
on Jul 12, 2012 at 05:32 UTC ( #981301=note: print w/replies, xml ) Need Help??


in reply to Re: biased random number picking
in thread biased random number picking

the slice is expensive and not really required:
my $choice = int(rand($#options + 1)); say 'Choice #', $_, ' is ', $options[$choice]; $options[$choice] = $options[-1]; pop @options;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://981301]
help
Chatterbox?
[Your Mother]: I prefer palatial fricatives.
[Lotus1]: https://en. wikipedia.org/ wiki/%C3%87
[Your Mother]: I'm headed out west, sucker.
[Lotus1]: the west is the best, get here we'll do the rest
LanX chjuman !
[Eily]: do you pronunce that /xju:mən/ then ?
[Eily]: that's not what I'd call a silent h :)
[LanX]: see soundfile https://en. wiktionary.org/ wiki/human# Pronunciation
[Your Mother]: Just Another Perl 'Acker.
[LanX]: I pronounce it 'juːmən'

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (15)
As of 2017-03-27 17:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.