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.

### 800. Issues in 26.4.7.1 [rand.util.seedseq](6)

Section: 28.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:

- Strictly speaking `end - begin` is not defined since `InputIterator` is not required to be a random access iterator.
- Currently all integral types are allowed as input to the `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 is accepted.

Proposed resolution:

Replace 28.5.8.1 [rand.util.seedseq] paragraph 6 with:

> Effects: Constructs a `seed_seq` object by effectively concatenating the low-order `u` 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 number `b` having a total of `n` bits, and then carrying out the following algorithm:

> > for( v.clear(); n > 0; n -= 32 ) v.push_back(b mod 232), b /= 232;

Rationale:

Addressed by N2836 "Wording Tweaks for Concept-enabled Random Number Generation in C++0X".