*This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.*

**Section:** 29.6.3.2 [rand.eng.mers] **Status:** CD1
**Submitter:** Stephan Tolksdorf **Opened:** 2007-09-21 **Last modified:** 2017-02-03

**Priority: **Not Prioritized

**View all other** issues in [rand.eng.mers].

**View all issues with** CD1 status.

**Discussion:**

The `mersenne_twister_engine` is required to use a seeding method that is given
as an algorithm parameterized over the number of bits `W`. I doubt whether the given generalization
of an algorithm that was originally developed only for unsigned 32-bit integers is appropriate
for other bit widths. For instance, `W` could be theoretically 16 and `UIntType` a 16-bit integer, in
which case the given multiplier would not fit into the `UIntType`. Moreover, T. Nishimura and M.
Matsumoto have chosen a dif ferent multiplier for their 64 bit Mersenne Twister
[reference].

I see two possible resolutions:

- Restrict the parameter
`W`of the`mersenne_twister_template`to values of 32 or 64 and use the multiplier from [the above reference] for the 64-bit case (my preference) - Interpret the state array for any
`W`as a 32-bit array of appropriate length (and a specified byte order) and always employ the 32-bit algorithm for seeding

See N2424 for further discussion.

*[
Bellevue:
]*

Stephan Tolksdorf has additional comments on N2424. He comments: "there is a typo in the required behaviour for mt19937_64: It should be the 10000th (not 100000th) invocation whose value is given, and the value should be 9981545732273789042 (not 14002232017267485025)." These values need checking.

Take the proposed recommendation in N2424 and move to REVIEW.

**Proposed resolution:**

See N2424 for the proposed resolution.

*[
Stephan Tolksdorf adds pre-Bellevue:
]*

I support the proposed resolution in N2424, but there is a typo in the required behaviour for

mt19937_64: It should be the 10000^{th}(not 100000^{th}) invocation whose value is given, and the value should be 9981545732273789042 (not 14002232017267485025). The change to para. 8 proposed by Charles Karney should also be included in the proposed wording.

*[
Sophia Antipolis:
]*

Note the main part of the issue is resolved by N2424.