Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a.SetProability(30);
- int count = 0;
- for (int i = 0; i < 60; i++)
- {
- if (a.GetEvent())
- {
- count++;
- }
- }
- cout << count << endl;
- class RandomGenerator
- {
- public:
- void SetProability(int p)
- {
- probility = p;
- }
- bool GetEvent()
- {
- int check = rand() % 60;
- if (check<=probility)
- {
- return true;
- }
- return false;
- }
- private:
- int probility = 0;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement