Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Re: Re: Re: Remove lowest number

by ellem (Hermit)
on Aug 06, 2003 at 16:04 UTC ( [id://281464]=note: print w/replies, xml ) Need Help??


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

Sadly this was done because I couldn't figure out a way to reroll 1s.

(you can see it but I filled with shame)
--
ellem@optonline.net
There's more than one way to do it, but only some of them actually work.

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Remove lowest number
by l2kashe (Deacon) on Aug 06, 2003 at 16:30 UTC
    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;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2024-04-24 18:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found