Title
Inconsistent specification of uniform_real_distribution constructor
Status
c++17
Section
[rand.dist.uni.real]
Submitter
Marshall Clow

Created on 2012-07-14.00:00:00 last changed 89 months ago

Messages

Date: 2014-11-24.13:56:51
xmlns:ns0="http://www.w3.org/1998/Math/MathML">

Proposed resolution:

This wording is relative to N4140.

  1. Add a note after paragraph 1 before the synopsis in [rand.dist.uni.real]:

    -1- A uniform_real_distribution random number distribution produces random numbers x , ax<b , distributed according to the constant probability density function

    p(x|a,b) = 1(b-a) .

    [Note: This implies that p(x|a,b) is undefined when a == b. — end note]

    Drafting note: p(x|a,b) should be in math font, and a == b should be in code font.

Date: 2014-11-08.00:00:00

[ 2014-11-08 Urbana ]

Moved to Ready with the note.

There remains concern that the constructors are permitting values that may (or may not) be strictly outside the domain of the function, but that is a concern that affects the design of the random number facility as a whole, and should be addressed by a paper reviewing and addressing the whole clause, not picked up in the issues list one distribution at a time. It is still not clear that such a paper would be uncontroversial.

Date: 2014-11-04.00:00:00

[ 2014-11-04 Urbana ]

Jonathan provides wording.

Date: 2012-08-20.17:54:42

uniform_real says in [rand.dist.uni.real] p1:

A uniform_real_distribution random number distribution produces random numbers x, a ≤ x < b,

but also that ([rand.dist.uni.real] p2):

explicit uniform_real_distribution(RealType a = 0.0, RealType b = 1.0);

-2- Requires: a ≤ b and b - a ≤ numeric_limits<RealType>::max().

If you construct a uniform_real_distribution<RealType>(a, b) where there are no representable numbers between 'a' and 'b' (using RealType's representation) then you cannot satisfy [rand.dist.uni.real].

An obvious example is when a == b.

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2015-05-22 18:31:21adminsetstatus: ready -> wp
2014-11-24 13:56:51adminsetmessages: + msg7202
2014-11-24 13:56:51adminsetstatus: open -> ready
2014-11-04 18:45:30adminsetmessages: + msg7167
2014-11-04 18:45:30adminsetmessages: + msg7166
2014-06-17 21:17:35adminsetstatus: new -> open
2012-07-14 00:00:00admincreate