Thought this would be a nice puzzle for some. :)
First, I take a random number from 1 to 10, then take that number and multiply it by 5, we'll call this result 'threshold'. Then I take another new random number from 1 to 100, and see if it is equal or lower than the 'threshold' number.
pseudocode:
th = rand(10) * 5; res = rand(100); if (res <= th) return TRUE;
Is this the simplest way to calculate this? I'm thinking one of rand(500) or rand(1000) would be the same, but I can't get my probability formulas to work.