mardi 26 janvier 2016

copy of objects random engine

I wrote a cpp class that generates a random process. I defined the random engine as a public attribute of my class.

My question is : what happens with the engine when I use the operator= :

Proc A; 
// operations on A 
Proc B;
B=A;

will it create a new engine for B initialised randomly ? Or will it create a engine that will generate pseudo-random numbers from where the engine of A stopped ?

Here is how I wrote the class :

class Proc {
  public:
mt19937 eng {random_device{}()};
double Tps;
vector<int> prc;
... }

Thanks for your help !




Aucun commentaire:

Enregistrer un commentaire