Boost Users :
Subject: Re: [Boost-users] [random] streamable state of normal_distribution to ostream not accurate
From: Dave Steenburgh (dave.steenburgh_at_[hidden])
Date: 2008-11-06 19:44:22
> mt19937 rng;
> normal_distribution<> gauss;
> variate_generator<mt19937&, normal_distribution<> > 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.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net