Boost logo

Boost Users :

From: mvogt_at_[hidden]
Date: 2003-07-03 19:53:57


Hello. I just experienced an assertion failure using the
boost::minstd_rand generator:

/home/packages/boost_1_29_0/boost/random/uniform_int.hpp:50:
boost::uniform_int<UniformRandomNumberGenerator, IntType>::uniform_int
(UniformRandomNumberGenerator &, IntType, IntType) [with
UniformRandomNumberGenerator = boost::random::linear_congruential<int32_t,
48271, 0, 2147483647, 399268537>, IntType = int]: Assertion `min < max'
failed.

I use the following code to generate random numbers:

typedef boost::minstd_rand RngType;
extern RngType pseudo_rng;

template <class T>
T random(T min, T max)
{
  boost::random_number_generator<RngType, T> rng(pseudo_rng);
  return rng(max - min + 1) + min;
}

Am I doing something wrong, or is there a fault in the uniform_int
algorithm?

Thanks,
Matt.

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
mail.administrator_at_[hidden]

**********************************************************************

[Non-text portions of this message have been removed]


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