Advertisement
iskhakovt

Untitled

Aug 12th, 2015
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <random>
  2. #include <iostream>
  3.  
  4. int main() {
  5. #if ( _WIN32 || __WIN32__ || _WIN64 || __WIN64__ )
  6.     srand(time(nullptr));
  7.     std::mt19937 gen(rand());
  8. #else
  9.     std::random_device rd;
  10.     std::mt19937 gen(rd());
  11. #endif
  12.    
  13.     std::uniform_real_distribution<> dis(0, 1);
  14.     for (int n = 0; n < 10; ++n) {
  15.         std::cout << dis(gen) << ' ';
  16.     }
  17.     std::cout << '\n';
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement