https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85439

--- Comment #5 from W E Brown <webrown.cpp at gmail dot com> ---
(In reply to Marc "Foddex" Oude Kotte from comment #4)
> The reason I was expecting the same result everywhere is because of this
> statement on cppreference.com:
> 
> 
> "Notes
> The 10000th consecutive invocation of a default-contructed std::mt19937 is
> required to produce the value 4123659995.
> 
> The 10000th consecutive invocation of a default-contructed std::mt19937_64
> is required to produce the value 9981545732273789042"
> 
> 
> Source:
> http://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine
> 
> Obviously I'm not testing the 10000th consecutive invocation but the 1st,
> but I still expected things to be similar (and they are, in 7/8 test cases).

The cited text is correct, but the attached program doesn't test it.

In particular, the attached program tests nothing about calling any Mersenne
twister object; rather, it looks at the results of calling
uniform_int_distribution objects.  As specified in C++, distribution objects
are not required to produce identical results across platforms, even if given
identical inputs.  Any expectation to the contrary is not supported by the C++
standard.

ISTM that testing the behavior of std::mt19937 and std::mt19937_64 -- or of any
engine, for that matter -- ought not involve any distribution object at all. 
Instead, such a test program should IMO be looking at the result(s) of directly
invoking the engine.

Comment #2 was exactly right.  I recommend this report be closed as invalid.

Reply via email to