C++: generate gaussian distribution

后端 未结 4 1836
囚心锁ツ
囚心锁ツ 2020-12-06 12:28

I would like to know if in C++ standard libraries there is any gaussian distribution number generator, or if you have any code snippet to pass.

Than

4条回答
  •  旧时难觅i
    2020-12-06 12:41

    C++ Technical Report 1 adds support for random number generation. So if you're using a relatively recent compiler (visual c++ 2008 GCC 4.3), chances are that it is available out of the box.

    See here for sample usage of std::tr1::normal_distribution (and many more).

提交回复
热议问题