Generating stock prices using geometric brownian motion I am writing a c++ class of "A simple least squares approach" by Longstaff and Schwartz. I have only finished writing a function for creating the stock price paths using geometric brownian motion. I am still a bit of a novice when it comes to writing classes in c++ and I just want to see if there is anything I can improve on with what I have written so far. 

That being said, should I include pointers or any other type of data structure to make the code better?

Here is my main.cpp:

#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;random&gt;
#include &lt;time.h&gt;
#include &lt;math.h&gt;
#include "LSM.h"

using namespace std;


int main(){
    const double r = 0.04;          // Riskless interest rate
    const double q = 0.0;           // Divident yield
    const double sigma = 0.20;      // Volatility of stock
    const double T = 1;             // Time (expiry)
    const int N = 2;                // Number of time steps
    const double K = 100.0;         // Strike price
    const double S0 = 102.0;        // Initial stock price
    const int M = 4;                // Number of paths
    const int R = 2;                // Choice of basis for Laguerre polynomial

    LSM Option_value(r,q,sigma,T,N,K,S0,M,R);











    return 0;
}


Here is the header file:

#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;random&gt;
#include &lt;time.h&gt;
#include &lt;math.h&gt;

using namespace std;


#ifndef LSM_H
#define LSM_H

class LSM {
public:
    // Overload Constructor
    LSM(const double, const double, const double, const int, const int, const double, const double, const int, const int);

    // Destructor
    ~LSM();

    // Generate M paths of stock prices (Geometric Brownian Motion)
    vector&lt;double&gt; GBM(const int, const int, const double, const double, const double, const double, const double);



private:
    // Member variables
    double new_r;
    double new_q;
    double new_sigma;
    int new_T;
    int new_N;
    double new_K;
    double new_S0;
    int new_M;
    int new_R;

};




#endif


and here is the .cpp file correlated to the header file above:

#include "LSM.h"


LSM::LSM( const double r, const double q, const double sigma, const int T, const int N, const double K, const double S0, const int M, const int R){
    new_r = r;
    new_q = q;
    new_sigma = sigma;
    new_T = T;
    new_N = N;
    new_K = K;
    new_S0 = S0;
    new_M = M;
    new_R = R;

    vector&lt;double&gt; v;
    v = GBM(new_M, new_N, new_T, new_r, new_q, new_sigma, new_S0);
    for(int i = 0; i &lt; v.size(); i++){
        cout &lt;&lt; v[i] &lt;&lt; endl;
    }


}

LSM::~LSM(){

}

vector&lt;double&gt; LSM::GBM(const int M, const int N, const double T, const double r, const double q, const double sigma, const double S0){
    double dt =  T/N;
    vector&lt;double&gt; Z;
    vector&lt;double&gt; S;
    S.push_back(S0);
    mt19937 e2(time(0));
    normal_distribution&lt;double&gt; dist(0.0, 1.0);
    for(int i = 0; i &lt; M; i++){
        Z.push_back(dist(e2));
    }
    double drift  = exp(dt*(r-0.5*sigma*sigma));
    double vol = sqrt(sigma*sigma*dt);
    for(int i = 1; i &lt; M; i++){
        S.push_back(S[i-1] * drift * exp(vol*Z[i]));
    }
    return S;
}
This looks like a really interesting use of Brownian motion! Neat idea! Here are some suggestions for improving the code:
Avoid using namespace std
In general, using using namespace std is a bad idea. In a header, it's a very bad idea. Here's one description of why.
Naming
You should name your function arguments in the header so a user of your code knows what they represent. For example, in the future, you might compile this into a library to include in other programs, and ship just the header and the compiled library. If you do that, a user of your library will have no idea what the arguments to the LSM constructor are. (And remember that that user may be a future you who doesn't remember all the details of the implementation!)
I'd also recommend that you use better names than 1 letter names that may be meaningless or worse, confusing to readers of your code. You have some great ideas for what the names should be in the comments in main(). Instead of adding comments to explain the names, just name the variables what you wrote in the comments. For example, instead of r, call it risklessInterestRate. Instead of q, call it dividendYield. Yes, it takes a little bit longer to type, but those few extra seconds of typing will end up saving minutes or hours of frustration if you get 2 of the variables with similar names confused (like M and N).
Headers
Only include what you need. Only include it where you need it. Your main() function doesn't need any header other than LSM.h, so it should be the only thing you include there. LSM.h doesn't need any of the files it has included except for &lt;vector&gt;. LSM.cpp should include those files instead because it does use them. It might not seem like a big deal now, but once your project gets a little bigger, including the wrong files or including files you don't need can really slow down a compile.
Constructors
In C++, the constructor should never call a virtual method of its own class because it's not yet fully constructed. Luckily your code does not do that. But it does call a non-virtual method. When I see that, it raises a red flag to me, because it's fairly common for a non-virtual method to later become virtual if a subclass needs to override it. For that reason, I tend to avoid calling any (non-static) methods of the same class within a constructor. Furthermore, the LSM::GBM function doesn't use any member variables or change any state in the object or call any member functions of LSM, so it could be implemented as a free-standing static function inside LSM.cpp. (Unless, of course, you're going to want other code outside the class to call it, in which case it should probably be a static member function of the LSM class.)
const
Nice use of const! So few people use it, so it's really refreshing to see it being used well. Good work!