#include <random>
std::mt19937 rng;                 // engine
std::normal_distribution<> dist;  // distribution

// rng()で生成される値は全処理系で同一
// dist(rng)で生成される値は処理系依存


2016-02-25追記:Boost.Randomライブラリの場合も、バージョン間で分布生成器アルゴリズムが変更される可能性があるため注意。詳細はコメント参照のこと。(thanks to id:faith_and_brave さん)


The algorithms for producing each of the specified distributions are implementation-defined.

N1398 A Proposal to Add an Extensible Random Number Facility to the Standard Libraryより根拠箇所を引用(下線部は強調)。

C. Separation of Engines and Distributions

This proposal attempts to specify the engines precisely; two different implementations, with the same seed, should return the same output sequence. This forces implementations to use the well-researched engines specified hereinafter, and users can have confidence in their quality and the limits thereof.

On the other hand, the specifications for the distributions only define the statistical result, not the precise algorithm to use. This is different from engines, because for distribution algorithms, rigorous proofs of their correctness are available, usually under the precondition that the input random numbers are (truely) uniformly distributed. For example, there are at least a handful of algorithms known to produce normally distributed random numbers from uniformly distributed ones. Which one of these is most efficient depends on at least the relative execution speeds for various transcendental functions, cache and branch prediction behaviour of the CPU, and desired memory use. This proposal therefore leaves the choice of the algorithm to the implementation. It follows that output sequences for the distributions will not be identical across implementations. It is expected that implementations will carefully choose the algorithms for distributions up front, since it is certainly surprising to customers if some distribution produces different numbers from one implementation version to the next.