
7 Nov
2008
7 Nov
'08
12:44 a.m.
mt19937 rng; normal_distribution<> gauss; variate_generator
> var(rng, gauss);
gauss is passed by value, and so var has a copy of it. This means that when you generate values with var, the state of gauss does not change.
cerr << gauss << endl; //dumps object internal state
The distribution() function of the variate_generator class returns a reference to the distribution being used. Try this instead: cerr << var.distribution() << endl; Then you should see the state changing; I did.