This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.
Section: 29.5.8.1 [rand.util.seedseq] Status: Resolved Submitter: Stephan Tolksdorf Opened: 2008-02-18 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [rand.util.seedseq].
View all issues with Resolved status.
Discussion:
The for-loop in the algorithm specification has n
iterations, where n
is
defined to be end - begin
, i.e. the number of supplied w-bit quantities.
Previous versions of this algorithm and the general logic behind it
suggest that this is an oversight and that in the context of the
for-loop n
should be the number of full 32-bit quantities in b
(rounded
upwards). If w
is 64, the current algorithm throws away half of all bits
in b
. If w
is 16, the current algorithm sets half of all elements in v
to 0.
There are two more minor issues:
end - begin
is not defined since
InputIterator
is not required to be a random access iterator.
seed_seq
constructor, including bool
. IMHO allowing bool
s unnecessarily
complicates the implementation without any real benefit to the user.
I'd suggest to exclude bool
s as input.
[ Bellevue: ]
Move to Open: Bill will try to propose a resolution by the next meeting.
[ post Bellevue: Bill provided wording. ]
This issue is made moot if 803^{(i)} is accepted.
Proposed resolution:
Replace 29.5.8.1 [rand.util.seedseq] paragraph 6 with:
Effects: Constructs a
seed_seq
object by effectively concatenating the low-orderu
bits of each of the elements of the supplied sequence[begin, end)
in ascending order of significance to make a (possibly very large) unsigned binary numberb
having a total ofn
bits, and then carrying out the following algorithm:for( v.clear(); n > 0; n -= 32 ) v.push_back(b mod 2^{32}), b /= 2^{32};
Rationale:
Addressed by N2836 "Wording Tweaks for Concept-enabled Random Number Generation in C++0X".