#include <iostream>
#include <math.h>
#include <random>
using namespace std;
int main()
{
while(true)
{
mt19937 rng;
rng.seed(std::random_device()());
uniform_real_distribution<mt19937::result_type> unif(0, 1); // distribution in range [0,1]
double num = unif(rng);
cout << num << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWF0aC5oPgojaW5jbHVkZSA8cmFuZG9tPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkKewogICAgd2hpbGUodHJ1ZSkKICAgIHsKICAgIG10MTk5Mzcgcm5nOwoJcm5nLnNlZWQoc3RkOjpyYW5kb21fZGV2aWNlKCkoKSk7Cgl1bmlmb3JtX3JlYWxfZGlzdHJpYnV0aW9uPG10MTk5Mzc6OnJlc3VsdF90eXBlPiB1bmlmKDAsIDEpOyAvLyBkaXN0cmlidXRpb24gaW4gcmFuZ2UgWzAsMV0KCWRvdWJsZSBudW0gPSB1bmlmKHJuZyk7CiAgIGNvdXQgPDwgbnVtIDw8IGVuZGw7IAogICAgfQogICAKICAgcmV0dXJuIDA7Cn0=
In file included from /usr/include/c++/5/random:49:0,
from prog.cpp:3:
/usr/include/c++/5/bits/random.h: In instantiation of 'class std::uniform_real_distribution<unsigned int>':
prog.cpp:13:54: required from here
/usr/include/c++/5/bits/random.h:1868:7: error: static assertion failed: template argument not a floating point type
static_assert(std::is_floating_point<_RealType>::value,
^
/usr/include/c++/5/bits/random.h: In instantiation of 'struct std::__detail::_Adaptor<std::mersenne_twister_engine<unsigned int, 32u, 624u, 397u, 31u, 2567483615u, 11u, 4294967295u, 7u, 2636928640u, 15u, 4022730752u, 18u, 1812433253u>, unsigned int>':
/usr/include/c++/5/bits/random.h:1981:6: required from 'std::uniform_real_distribution<_RealType>::result_type std::uniform_real_distribution<_RealType>::operator()(_UniformRandomNumberGenerator&, const std::uniform_real_distribution<_RealType>::param_type&) [with _UniformRandomNumberGenerator = std::mersenne_twister_engine<unsigned int, 32u, 624u, 397u, 31u, 2567483615u, 11u, 4294967295u, 7u, 2636928640u, 15u, 4022730752u, 18u, 1812433253u>; _RealType = unsigned int; std::uniform_real_distribution<_RealType>::result_type = unsigned int]'
/usr/include/c++/5/bits/random.h:1973:51: required from 'std::uniform_real_distribution<_RealType>::result_type std::uniform_real_distribution<_RealType>::operator()(_UniformRandomNumberGenerator&) [with _UniformRandomNumberGenerator = std::mersenne_twister_engine<unsigned int, 32u, 624u, 397u, 31u, 2567483615u, 11u, 4294967295u, 7u, 2636928640u, 15u, 4022730752u, 18u, 1812433253u>; _RealType = unsigned int; std::uniform_real_distribution<_RealType>::result_type = unsigned int]'
prog.cpp:14:23: required from here
/usr/include/c++/5/bits/random.h:167:2: error: static assertion failed: template argument not a floating point type
static_assert(std::is_floating_point<_DInputType>::value,
^