View Single Post
Old 03-18-2006, 02:00 PM   #9 (permalink)
XxSP1DERxX
 
Join Date: Oct 2002
Age: 23
Posts: 4,689
Default

there are multiple ways to approach this..

If you want an even chance for 6 objects to be used, you would do

switch ( Utility.Random( 6 ) )
{
case 0: blah blah; break;
case 1: blah blah; break;
....
case 5: blah blah; break;
}

if you want a 20% chance for one thing, a 40% chance for another, and a 30% chance for a third, and the rest for a fourth, you would do it like this

double random = Utility.RandomDouble();
if ( 0.20 > random )
blah blah;
else if ( 0.60 > random )
blah blah;
else if ( 0.90 > random )
blah blah;
else
blah blah;
XxSP1DERxX is offline   Reply With Quote