Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random class

Status
Not open for further replies.

ogbankgirl

Programmer
Jan 18, 2003
1
US
Hi, I need to randomize some output, where I do one action a certain percentage of the time and another action the other percentage of the time. Is there a way I can get, let's say, a boolean, returned a% of the time, and another boolean returned b% of the time? Thanks.
 
I don't think there is a random boolean function. But you can get a random int, then check if it is even or odd using %, then use this as a boolean ??

good luck "so many events, so little time"
 
when i said use '%', that is the mod function, mod it with 2, so that you can tell if it is odd or even "so many events, so little time"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top