Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <fstream>
- #include <iostream>
- #include <string>
- #include <vector>
- #include <cstdlib> // для функций rand() и srand()
- #include <ctime> // для функции time()
- int getRandomNumber(int min, int max) {
- static const double fraction = 1.0 / (static_cast<double>(RAND_MAX) + 1.0);
- // Равномерно распределяем рандомное число в нашем диапазоне
- return static_cast<int>(rand() * fraction * (max - min) + min);
- }
- using namespace std;
- int main(int argc, char* argv[]) {
- srand(static_cast<unsigned int>(time(0)));
- setlocale(0, "");
- vector<string> first = {"Леденая сфера", "Удар щитом", };
- vector<string> second = {"Рубака", "Покоритель", };
- cout << first[getRandomNumber(0, first.size())] << " "
- << second[getRandomNumber(0, second.size())];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement