Search code examples
c++randomgnu

LogNormal Distribution / C++ gnu


I want to generate random points (x,y) using log normal distribution in c++ gnu

I know it needs parameters mean and variance, but how I can call it?


Solution

  • Use the new cool C++11 STL random system.

    std::mt19937 mt(/*seed*/);
    std::lognormal_distribution<float> dist(/*mean*/, /*variance*/);
    
    float randomValue = dist(mt);