Distribution generators in C++
11 Nov 2021I went looking around for generators to produce normal distributions in C++. It turns out this has been a thing since C++11! and is in the std
namespace. You’ll need to #include <random>
. There’s also a uniform distribution, and many more. The references are great, so I will just leave them here for me to come back to when I forget the syntax:
Normal distribution reference.
Uniform distribution reference.
An important cavaet – the random number generator choice matters. See more at another TIL.