在C ++中使用正态分布的随机数

时间:2011-11-01 05:15:19

标签: c++ boost-random

作为explained by John,我尝试了这个:

#include <boost/tr1/random.hpp>

std::tr1::mt19937 eng;  // a core engine class
std::tr1::normal_distribution<double> dist; 
for (int i = 0; i < 10; ++i)
    std::cout << dist(eng) << std::endl;

但我的输出为 -1。#IND ,这是一个floating point exception

我做错了什么?

0 个答案:

没有答案