Boost logo

Boost Users :

From: gast128 (gast128_at_[hidden])
Date: 2006-02-14 07:23:02


Dear all,

probably alread posted a hundred times, but the follwoing code hangs on my pc:

int MakeRandomInt()
{
    const int nMin = std::numeric_limits<int>::min();
    const int nMax = std::numeric_limits<int>::max();

    typedef boost::minstd_rand Generator;
    typedef boost::uniform_int<> Distributor;
    typedef boost::variate_generator<boost::minstd_rand, Distributor>
VariateGenerator;

    Generator generator(static_cast<unsigned>(time(NULL)));
    Distributor uni_dist(nMin, nMax);
    VariateGenerator uni(generator, uni_dist);

    return uni();
}

Making the range half the size does help. Did I miss the documentation?

Wkr,
me


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