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;
|