Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //c++11
- #include <random>
- int get_random_int(int max, int min=0)
- {
- std::random_device rd;
- // if range is wrong,return min-1
- if ((max-min)<=1)
- return min-1;
- int num = min+rd()%(max-min-1);
- return num;
- }
Add Comment
Please, Sign In to add comment