【发布时间】:2012-05-31 12:32:16
【问题描述】:
有人能告诉我这段代码使用 boost 的正态分布是怎么回事吗?
boost::mt19937 rng; // A random number generator
boost::normal_distribution<> nd(3.0, 1.0); // mean 3, sigma 1
// Attach the distribution to the random number generator to get a function
// that returns normally distributed variables.
boost::variate_generator<boost::mt19937&,boost::normal_distribution<> > var_nor(rng, nd);
// Use it. But why is function signature different?
double x = var_nor();
我对 var_nor 及其两个函数签名的情况感到困惑。 谢谢 皮特
【问题讨论】:
标签: c++ function boost signature