The C++ standard specifies pretty closely under [rand.util.canonical] just how the template function std::generate_canonical
works (though it only presents pseudocode, not C++ code).
Is is the intention of the spec authors that on different platforms where math on the RealType
works identically, and for a deterministic URNG
that gives the same outputs on the two platforms, that std::generate_canonical
gives identical outputs as well?
This is related to similar questions like Is 1.0 a valid output from std::generate_canonical? -- the prose states that 1.0 is excluded, but the algorithm that they give in pseudocode includes it as an output sometimes and for some combinations of RealType
and URNG
.
This is in contrast to the random number distribution functions, discussed e.g., as C++11 random number distributions are not consistent across platforms -- what alternatives are there?; the standard does '''not''' specify how e.g., the normal distribution is generated, just its properties
I haven't found any DRs where this is discussed, and the wording of the standard is superficially identical in the C++11, C++14 and C++17 draft standards I have easy access to.