我正在使用GCC版本4.4.7的服务器,不幸的是我被迫使用这个版本.我想利用<random>C++ 0x库,但我在这里读到,在这个版本中uniform_real_distribution被调用uniform_real.当我尝试调用此函数时normal_distribution,我没有得到有用的输出.看这个例子:
#include <random>
#include <iostream>
using namespace std;
int main()
{
typedef std::mt19937 Engine;
typedef std::uniform_real<double> Dis1;
typedef std::normal_distribution<double> Dis2;
Engine eng(0);
Dis1 dis1(0, 1);
cout << dis1(eng) << endl; //OUTPUTS 3.49921e+09
Dis2 dis2(0, 1);
cout << dis2(eng) << endl; //STALLS, NO OUTPUT
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我编译,g++44 -std=c++0x main.cpp我已经显示了我得到的输出.这是什么问题?