Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: random number with range

by ikegami (Pope)
on Jun 01, 2006 at 18:06 UTC ( #553108=note: print w/ replies, xml ) Need Help??


in reply to Re^2: random number with range
in thread random number with range

Indeed, but the technique is particularly useful for sets. For example,

my @set = ( 1, 2, 3, 5, 8, 13, 21 ); my $random = $set[rand(@set)];
my @set = qw( apple orange banana cucumber ); my $random = $set[rand(@set)];


Comment on Re^3: random number with range
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://553108]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2014-07-10 06:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (200 votes), past polls