language: C++11 (gcc-4.7.2)
date: 186 days 4 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
#include <random>
#include <ctime>
int main()
{
    //std::random_device seed;
    //std::mt19937 rnd(seed()); // no access to hardware on ideone
    std::mt19937 rnd(std::time(NULL));
    std::uniform_real_distribution<> d(1, 2);
 
    for(int n = 0; n < 10; ++n)
        std::cout << d(rnd) << ' ';
    std::cout << '\n';
}