cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
30 % possibility
30 % possibility
Feb 24, 2012 at 2:26pm UTC
jmrag
(19)
Can you provide me with a code where
1
2
3
4
5
6
7
...........
if
(....) {....}
where if has 30% possibility to be executed?
Feb 24, 2012 at 2:34pm UTC
Gaminic
(1621)
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/
Feb 24, 2012 at 3:12pm UTC
jmrag
(19)
thx a lot!! you really helped!
Topic archived. No new replies allowed.