Ok. So I just want to get peoples opinion on this.

If you were to get a percentage on something, say... You will survive with a 22% chance. Would the best way to do this return a random number, and if that number is <= 22 be the chance or...? how would you do it?

I don't want any code of anything, just opinions. (:

A random number between 0-100. Determining the percentage.
Last edited on

From the first example:
v1 = rand() % 100;         // v1 in the range 0 to 99 

Simply test if v1 is <= 22.

Topic archived. No new replies allowed.