Random value generation for uncertainty analysis I am a beginner in coding, writing my first bigger C++ project (aircraft initial sizing program). This code should be able to analyze the design in a probabilistic manner by using Monte Carlo Simulation. Hence, I have to generate random values for several independent random variables.

As I want to learn, how to program good code, I would be thankful for reviewing the simplified 'random number generation'-part of my code:

settings.h

#ifndef SETTINGS_H
#define SETTINGS_H

#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;vector&gt;


class settings
{

public:
    struct distInput
    {
        std::string distName;
        double paramA; 
        double paramB;
        double paramC;
    };

    std::vector&lt;distInput&gt; distInputs;

    settings();
};


settings.cpp

#include "settings.h"


settings::settings()
{
    //Read input from file, here simplified
    distInput input1 = 
    {
        "Normal Distribution",
        100.,
        1.,
        0.
    };

    distInput input2 = 
    {
        "Triangular Distribution",
        80.,
        100.,
        109.
    };

    distInputs.push_back(input1);
    distInputs.push_back(input2);
}
//here are more functions


uncertainty.h

#ifndef UNCERTAINTY_H
#define UNCERTAINTY_H

#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;random&gt;
#include &lt;vector&gt;


class uncertainty
{
public:
    void generateRN();

    std::vector&lt;std::mt19937_64&gt; randomNumberGenerators;
    std::vector&lt;std::vector&lt;double&gt;&gt; randomNumbers;
    settings *mySettingsPt;
    std::vector&lt;settings::distInput&gt; *inputData;

    uncertainty(settings &amp;mySettings, double numbersRV);        
};


uncertainty.cpp

#include "uncertainty.h


uncertainty::uncertainty(settings &amp;mySettings, double numbersRV)
    :
    mySettingsPt(&amp;mySettings),
    inputData(&amp;mySettingsPt-&gt;distInputs)
{
    for(unsigned int i = 0; i &lt; numbersRV; ++i)
    {
        std::random_device rd;
        std::mt19937_64 mt_tmp(rd());
        randomNumberGenerators.push_back(mt_tmp);
        randomNumbers.resize(numbersRV);
    }    
}

void uncertainty::generateRN() 
{
    unsigned int numRV = inputData-&gt;size();

    for(unsigned int i = 0; i &lt; numRV; ++i)
    {
        std::string name = inputData-&gt;at(i).distName;
        double a = inputData-&gt;at(i).paramA;
        double b = inputData-&gt;at(i).paramB;
        double c = inputData-&gt;at(i).paramC;

        if(name == "Normal Distribution")
        {
            std::normal_distribution&lt;&gt; dist(a, b);
            randomNumbers.at(i).push_back(dist(randomNumberGenerators.at(i)));
        }
        else if(name == "Triangular Distribution")
        {
            std::uniform_real_distribution&lt;&gt; dist(0, 1);
            double F = (b - a) / (c - a);
            double U = dist(randomNumberGenerators.at(i));
            if (U &lt;= F)
                randomNumbers.at(i).push_back(a + sqrt(U * (c - a) * (b - a)));
            else
                randomNumbers.at(i).push_back(c - sqrt((1 - U) * (c - a) * (c - b)));
        }
    }
};


main.cpp

#include "settings.h"
#include "uncertainty.h"
#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;vector&gt;
#include &lt;random&gt;


int main()
{
    // Initialize objects for computation
    settings mySettings;
    uncertainty myUncertainty(mySettings, mySettings.distInputs.size());

    // Start Computation
    for(unsigned int i = 0; i &lt; 100; ++i)
    {
        myUncertainty.generateRN();
        // Other code, that uses the random values
    }
}


The code works fine, but I never had somebody reviewing my code skills. Improvement suggestions of any kind (How to structure .cpp and h. files, how to write that code more efficient, use of data structures and objects, etc.) are very welcome!
You've clearly spent some time looking into best practices; your code is well separated, readable, logical. Keep up the formatting, and people will be happy to read over your code.

This did jump out at me though: you have two specific string literals "Normal Distribution" and "Triangular Distribution" that are repeated in separate files.. Advisable to avoid multiple instances of a string literal in future, especially in separate files; when code gets large, approaches like that can be time consuming and erroneous. 

Think: constants and enums. Your compiler won't pick up on string literal typos like that, which could lead to irritating runtime errors or unexpected behaviour. On the other hand, it will of course alert you to undeclared (mistyped) handles in your code. Much more efficient bug removal.