Opened 12 years ago
Closed 12 years ago
#5298 closed Bugs (fixed)
Normal distribution: copy constructor doesn't yield intuitive correct behavior
Reported by: | Owned by: | Steven Watanabe | |
---|---|---|---|
Milestone: | To Be Determined | Component: | random |
Version: | Boost 1.46.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Purging the cache in the copy constructor of normal_distribution is not fine. The compiler generated copy constructor yields the correct behavior.
In the attached example a generator (A) using normal_distribution is called once before a generator (B) is created as a copy of (A). The expected behavior is that calling (A) and (B) now produces identical sequences. But they don't.
The attached example shows that using uniform_int instead normal_distribution yields the expected behavior.
Applying the compiler generated copy constructor worked fine for me. Well, I expect that there was a reason to purge the cache although I can't see it. But for consistence and to provide intuitive correct behavior I suggest to apply the compiler generated copy constructor.
Attachments (1)
Change History (2)
by , 12 years ago
Attachment: | testRandom.cpp added |
---|
comment:1 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This has already been fixed in the trunk, since the current draft standard mandates the behavior that you want. The fix should be in 1.47.