Boost logo

Boost :

From: Alan Stokes (alan_at_[hidden])
Date: 2004-01-13 12:40:01

This just bit me rather unpleasantly.

uniform_int is supposed to model a uniform random number generator. Neither the
specification of uniform_int nor the definition of uniform random number
generator disallow a singleton range, but uniform_int doesn't handle it - it
either hits an assertion, or does a divide by zero (if assertions are being elided).

A consequence is that random_number_generator also fails to meet its
specification if invoked with an argument of 1, since it attempts to construct a
uniform_int with min = max = 0. (random_number_generator claims to model
RandomNumberGenerator as defined in the standard at 25.2.11; there the argument
is only restricted to be strictly positive, so 1 is legitimate.)

This was previously raised in message 26381 as an inconvenience rather than a
bug, but in any case I don't think there was any response.

- Alan

Boost list run by bdawes at, gregod at, cpdaniel at, john at