Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Re: Re: Re: Re: Remove lowest number

by l2kashe (Deacon)
on Aug 06, 2003 at 16:30 UTC ( #281475=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Re: Re: Remove lowest number
in thread Remove lowest number

my $onetosix = int(rand(6) + 1);

rand will take its argument, and return a number somewhere between 0 and n-1 (0 -> 5 in this case). Actually it will return, though I'm not sure to what decimal depth, a random fractional number (0.0* -> 5.9*). Applying int() to the result causes it to round the fractional to a whole number. Then we add one.

use perl;


Comment on Re: Re: Re: Re: Re: Remove lowest number
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (12)
As of 2015-07-28 09:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (254 votes), past polls