Advertisement
Guest User

random number generation c++

a guest
Aug 9th, 2012
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. #include <random>
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6. std::random_device rd;
  7. std::mt19937 gen(rd());
  8. std::uniform_int_distribution<> dis(-1, 1);
  9. for(int n=0; n<10; ++n)
  10. std::cout << dis(gen) << ' ';
  11. std::cout << '\n';
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement