Opened 11 years ago
Closed 11 years ago
#5767 closed Bugs (fixed)
A bug in seeding with sequence in Mersenne Twister
| Reported by: | Owned by: | Steven Watanabe | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | random |
| Version: | Boost 1.47.0 | Severity: | Regression |
| Keywords: | Cc: |
Description
There is a bug in boost/random/mersenne_twister.hpp:
176 // fix up the state if it's all zeroes.
177 if((x[0] & (~static_cast<UIntType>(0) << r)) == 0) {
178 for(std::size_t j = 1; i < n; ++j) {
179 if(x[j] != 0) return;
180 }
Since there is a typo in line 178 ("i < n" should be "j < n"), x[0] will always be reset to some constant (static_cast<UIntType>(1) << (w-1)).
Attachments (1)
Change History (3)
by , 11 years ago
| Attachment: | random.patch added |
|---|
comment:1 by , 11 years ago
| Owner: | changed from to |
|---|
comment:2 by , 11 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.

(In [74169]) Use the right variable. Fixes #5767.