Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <chrono>
- #include <thread>
- // 0 .. 32767
- // n % m
- // n % 2 -> [0,1]
- // n % 3 -> [0,1,2]
- // n % 7 -> [0,1,2,3,4,5,6]
- // n % m -> [0..m-1]
- // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
- int main()
- {
- int randNum{ 0 };
- srand(time(0));
- int start{ 100 };
- int end{ 150 };
- for (int i{ 0 }; i < 10; ++i)
- {
- randNum = start + rand() % (end - start +1);
- std::cout << randNum << '\n';
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment