This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.
philox_engine::max()
Section: 29.5.4.5 [rand.eng.philox] Status: WP Submitter: Ruslan Arutyunyan Opened: 2024-09-18 Last modified: 2024-11-28
Priority: Not Prioritized
View all other issues in [rand.eng.philox].
View all issues with WP status.
Discussion:
There is a typo in philox_engine
wording that makes "-1" two times
instead of one for max()
method.
The reason for that typo is that the wording was originally inspired by
mersenne_twister_engine
but after getting feedback that what is written in
the philox_engine
synopsis is not C++ code, the authors introduced the
m variable (as in subtract_with_carry_engine
) but forgot to remove
"-1" in the m definition.
Note: after the proposed resolution below is applied the m variable
could be reused in other places: basically in all places where the mod 2^w
pattern appears (like subtract_with_carry_engine
does).
The authors don’t think it’s worth changing the rest of the wording to reuse
the m variable.
If somebody thinks otherwise, please provide such feedback.
[2024-10-02; Reflector poll]
Set status to Tentatively Ready after six votes in favour during reflector poll.
[Wrocław 2024-11-23; Status changed: Voting → WP.]
Proposed resolution:
This wording is relative to N4988.
Modify 29.5.4.5 [rand.eng.philox] as indicated:
-1- Aphilox_engine
random number engine produces unsigned integer random numbers in theclosedinterval [0, m]), where m = 2w− 1and the template parameter w defines the range of the produced numbers.