To anwer the second part of your question, it is a lot more difficult to make a non-fractional (as in, not 1 / integer) chance happen. The easiest way I can think of is to conduct two checks that add up to the desired percentage, and if either passes you return a true.
As in, if you want 40%, you could hack it together with two 20% throws, which is a 1/5 shot. Not perfect, but better than nothing.
You can also make it fire for two numbers instead of one, instead of making an entirely second throw:
Code:
self.iHealChance = self.getRandomNumber( 3 )
if self.iHealChance == 0:
Code:
self.iHealChance = self.getRandomNumber( 3 )
if (self.iHealChance == 0) or (self.iHealChance == 1):
Makes that from a 25% (1 in 4) to 50% (2 in 4) chance, etc. Which might make some of the more obscure percents easier to make.
For a 35%, really 33.3% is so close and easy to do comparatively, I would just do the 1 in 3 chance as opposed to making complicated odds.