I have a simple class which will be useful for me with generating random numbers using default_random_engine
.
Random.h:
#include <random>
using namespace std;
class Random
{
public:
Random();
~Random() {}
private:
static default_random_engine _engine;
};
Random.cpp:
#include "Random.h"
Random::Random()
{
_engine = default_random_engine{}; //Will this be initialized every time I create an object of type Random?
}
Will _engine
be initialized every time I create an object of type Random
?
I just want it to stay like it is after the first initialization because I was told I can use the same engine multiple times.