Advertisement
vlatkovski

Really fast random numbers that take 20% of your CPU

Mar 7th, 2018
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.     std::ios::sync_with_stdio(false);
  6.     random_device rd;
  7.     mt19937 mt(rd());
  8.     uniform_int_distribution<> dist1(1, 500);
  9.     uniform_int_distribution<> dist2(33, 125);
  10.     while (true) {
  11.         for (int i = 0; i < dist1(mt); ++i) {
  12.             cout << dist2(mt);
  13.         }
  14.         cout << endl;
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement