If I seed with the same seed I want the same sequence of numbers no matter if I use GCC, Clang, VC++ or Windows, Linux, Mac. I think this is guaranteed by the standard engines in <random>.
I also want to be able to save the state of engines and restore them in a program compiled with a different compiler. I have been under the impression that the stream operators for the standard engines did not guarantee this kind of compatibility across implementations but after looking a bit closer I think it should work, assuming obvious stuff like CHAR_BIT == 8 and that the same character set is used. Please, correct me if I'm wrong.
When it comes to distributions like std::uniform_int_distribution and std::geometric_distribution I don't think I can rely on a consistent behavior. It looks like the standard only say what probability density function they should have. It doesn't explain how exactly the output should be calculated from the number that the engine produce. For this reason I don't think I can use any of the distributions in the standard library if I want a consistent sequence of numbers everywhere.
So am I correct that I can safely use the standard engines as long as I don't use the distributions? Or do I have to use a library with a fixed implementation to guarantee this to work consistently across compiler implementations?
am I correct that I can safely use the standard engines as long as I don't use the distributions?
I suppose so, I didn't find anything that would contradict your assumpion as used algorithms and their parameters are well defined.
When it comes to distributions I don't think I can rely on a consistent behavior
I think you are correct and only consistency within implementation guaranteed. So you might want to write your own distibution implementation (or copy one from standard library of the compiler of your choosing) to get consistent result.
> So am I correct that I can safely use the standard engines as long as I don't use the distributions?
Yes.
> I think it should work, assuming obvious stuff like CHAR_BIT == 8 and that the same character set is used.
As per the IS, with the format flags set to ios_base::dec and ios_base::left, and fill character set to the space character. (Also the same locale and same char_traits).