Skip to content

Instantly share code, notes, and snippets.

@ThatNerdyPikachu
Created March 26, 2019 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThatNerdyPikachu/4a52aab34820943eeb0b3c1ba54b8d2d to your computer and use it in GitHub Desktop.
Save ThatNerdyPikachu/4a52aab34820943eeb0b3c1ba54b8d2d to your computer and use it in GitHub Desktop.
implementation of 10print in c++
#include <iostream>
#include <random>
#include <unistd.h>
int RNGRange(int x, int y) {
std::random_device rnd;
std::mt19937 eng(rnd());
std::uniform_int_distribution<> dstr(x, y);
return dstr(eng);
}
char GetNextChar() {
if (RNGRange(0, 1) == 0) {
return '/';
} else {
return '\\';
}
}
void TenPrint() {
for (int i = 0; i <= 30; i++) {
for (int i = 0; i <= 65; i++) {
std::cout << GetNextChar() << std::flush;
usleep(5000);
}
std::cout << "\n";
}
}
int main() {
TenPrint();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment