pneave

C++ random numbers

Dec 10th, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.24 KB | None | 0 0
  1. #include <random>
  2. #include <iostream>
  3.  
  4. int main() {
  5.     std::random_device rd;
  6.     std::mt19937 mt(rd());
  7.     std::uniform_real_distribution<double> dist(1.0, 10.0);
  8.  
  9.     for (int i=0; i<16; ++i)
  10.         std::cout << dist(mt) << "\n";
  11. }
Add Comment
Please, Sign In to add comment