30 % possibility

Can you provide me with a code where

1
2
3
4
5
6
7
...........

if(....)
{....}



where if has 30% possibility to be executed?
Another way to look at 30% is 30/100 ('thirty out of a hundred'). Thus, if you generate a uniformly distributed random number x in [0,100], then you have a 30% chance that x <= 30.

For the actual implementation, check this webpage:
http://www.cplusplus.com/reference/clibrary/cstdlib/rand/
thx a lot!! you really helped!
Topic archived. No new replies allowed.