Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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 romping around the Monastery: (6)
As of 2015-08-01 17:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found
    past polls