« Return to Thread: boost::random distribution is not working within a custom class

Re: boost::random distribution is not working within a custom class

by Steven Watanabe-4 :: Rate this Message:

Reply to Author | View in Thread

AMDG

Oliver Fochler wrote:

> Some minimal example
>
> -----------------
> random2.h
> -----------------
> <snip>
> class randomNumberGenerator
> {
>    <snip>
>  private:
>    boost::uniform_01<boost::mt19937&, double> * ran_boost;
> };
>
> -----------------
> random2.cpp
> -----------------
>
> <snip>
>
> randomNumberGenerator::randomNumberGenerator( const uint32_t s )
> {
>  boost::uniform_01<boost::mt19937&, double> * ran_boost = new
> boost::uniform_01<boost::mt19937&, double>( rng_mt_boost );
>  rng_mt_boost.seed( s );
>  

You're creating a local variable here, not initializing the
member ran_boost.

>  std::cout << ran_boost->operator()() << std::endl;
> }
>  

In Christ,
Steven Watanabe

_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

 « Return to Thread: boost::random distribution is not working within a custom class