Opened 19 years ago

Closed 18 years ago

#242 closed Bugs (Fixed)

Silent random_number_generator failure.

Reported by: expaler Owned by: jmaurer
Milestone: Component: random
Version: None Severity:
Keywords: Cc:

Description

The test program attached to this message fails
silently when attempting to execute line 54.  (The test
does not return, but no exceptions or errors are
thrown, either.)  The culprit is in
<boost/random/random_number_generator.hpp>, line 52:
the variate_generator's first template parameter is
base_type.  Changing it to base_type& will squash the bug.

Cromwell Enage

Change History (2)

comment:1 by expaler, 19 years ago

Logged In: YES 
user_id=901287

Attached to this comment is a refinement of
<boost/random/random_number_generator.hpp> that requires
only uniform_int instead of variate_generator; furthermore,
in member operator() with parameter n, the uniform_int
object is only recreated if max() != n - 1.

Cromwell Enage

comment:2 by jmaurer, 18 years ago

Status: assignedclosed
Logged In: YES 
user_id=53943

Thanks for the bug report.
I've added the reference to the instantiation of
variate_generator.

However, I won't use your wholesale replacement, because it
looks like it's going to fail when the underlying generator
returns "double" values (between 0 and 1, for example). One
of the features of the variate_generator<> is that it
converts appropriately.

Jens Maurer
Note: See TracTickets for help on using tickets.