Created on 2019-12-10.00:00:00 last changed 24 months ago
Proposed resolution:
This wording is relative to N4840.
Modify [rand.syn], header <experimental/random> synopsis, as indicated:
#include <random> namespace std::experimental { inline namespace fundamentals_v3 { // 10.1.2.1, Function template randint template <class IntType> IntType randint(IntType a, IntType b); void reseed(); void reseed(default_random_engine::result_typeuint_fast32_t value); } // inline namespace fundamentals_v3 } // namespace std::experimental
Modify [rand.util.randint] as indicated:
-1- A separate per-thread engine of
[…]type default_random_engine (C++17 §29.6.5)unspecified type that meets the requirements of random number engine (C++17 [rand.req.eng]), initialized to an unpredictable state, shall be maintained for each thread. [Note: The implementation may choose the engine type on the basis of performance, size, quality, or any combination of such factors, so as to provide at least acceptable engine behavior for relatively casual, inexpert, and/or lightweight use. — end note]void reseed(); void reseed(default_random_engine::result_typeuint_fast32_t value);-7- Effects: Let g be the per-thread engine. The first form sets g to an unpredictable state. The second form invokes g.seed(value).
-8- Postconditions: Subsequent calls to randint do not depend on values produced by g before calling reseed. [Note: reseed also resets any instances of uniform_int_distribution used by randint. — end note]
[ 2022-11-30; LWG telecon ]
Prefer to keep an open issue for the TS than to possibly forget to address it if this feature is proposed for the IS some day.
[ 2022-10-19; Reflector poll ]
Set status to "Tentatively NAD" based on LEWG recommendation and reflector poll.
[ 2020-05-28; LEWG issue reviewing ]
LEWG issue processing voted to reject 3357 as NAD. Status change to Open.
Reject LWG3357 as NAD SF F N A SA 1 10 4 2 1
[ 2020-01 Priority set to 3 and assigned to LEWG after review on the reflector. ]
Addresses: fund.ts.v3
Although "implementation may select this type on the basis of performance, size, quality, or any combination of such factors," but changing this typedef is an ABI-break for implementations. Specifying per-thread engine to use this typedef results in losses of performance, size, and/or quality.
Since this type is not involved in randint facilities' interface (other than its member typedef), the current specification should be relaxed.History | |||
---|---|---|---|
Date | User | Action | Args |
2022-11-30 17:53:33 | admin | set | messages: + msg13131 |
2022-11-30 17:53:33 | admin | set | status: nad -> open |
2022-10-19 20:26:42 | admin | set | messages: + msg12874 |
2022-10-19 20:26:42 | admin | set | status: open -> nad |
2020-05-31 09:54:47 | admin | set | messages: + msg11319 |
2020-05-31 09:54:47 | admin | set | status: lewg -> open |
2020-01-05 16:13:01 | admin | set | messages: + msg10908 |
2020-01-05 16:13:01 | admin | set | status: new -> lewg |
2019-12-12 19:07:08 | admin | set | messages: + msg10887 |
2019-12-10 00:00:00 | admin | create |