
SourceForge.net wrote:
Bugs item #1464566, was opened at 2006-04-04 19:31 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1464566&group_id=7586
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: random Group: None Status: Open Resolution: None Priority: 5 Submitted By: Hubert Chan (uhoreg) Assigned to: Jens Maurer (jmaurer) Summary: uniform_01 copies engine instead of using a reference
Initial Comment: In the uniform_01 class, the constructor takes a base_type (i.e. the random number generator) as its argument, and the _rng member is just a base_type. This results in uniform_01 copying the random number generator, along with its state. Thus if one creates several uniform_01 objects (e.g. one at the beginning of each of several functions), they will all return the same random numbers.
The constructor should take a reference (i.e. base_type&) as its argument, and the _rng member should be a base_type&. (Indeed, the documentation at http://www.boost.org/libs/random/random-distributions.html#uniform_01 says that the constructor takes a base_type&.)
This looks like a serious mistake that should be fixed for 1.34.