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

Re: Need help with number generator

by lolindrath (Scribe)
on Aug 09, 2000 at 23:41 UTC ( #27169=note: print w/ replies, xml ) Need Help??


in reply to Need help with number generator

This maybe?

$randnum = int(rand(100)); if ( $randnum > 20 ) #80% { #stuff for 1 } if ( $randnum > 90 ) #10% { #stuff for 2 and 3 }


--=Lolindrath=--


Comment on Re: Need help with number generator
Download Code
Replies are listed 'Best First'.
RE: Re: Need help with number generator
by cmburns (Acolyte) on Aug 10, 2000 at 19:03 UTC
    I don't want to be picky, but that would do #stuff for 1 70% of the time.

    It would do #stuff for 1 _and_ #stuff for 2 and 3 10% of the time.

    And 20% of the time it would do nothing...

    Remember to think before you code! :-P

    cmburns

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2015-07-31 23:45 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 (282 votes), past polls