Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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 taking refuge in the Monastery: (9)
As of 2014-09-18 11:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (111 votes), past polls