Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <random>
- #include <vector>
- #include <Windows.h>
- std::vector<std::string> list {"h", "e", "l", "o", "w", "r", "d", " ","i"};
- int getRandomInt(int minRange, int maxRange) {
- std::random_device rd;
- std::mt19937 gen(rd());
- std::uniform_int_distribution<int> distribution(minRange, maxRange);
- return distribution(gen);
- }
- int main() {
- std::string ans = "";
- while (ans != "hello world") {
- ans = "";
- for (int i = 0; i < 11; i++) {
- ans += list[getRandomInt(0, list.size() - 1)];
- }
- std::cout << ans << "\n";//for funny even though logging it is not really necessary and may affect performance
- }
- std::cout << ans << "\n";
- Beep(1000, 2000);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement