lundi 16 octobre 2017

uniform_real_distribution is not uniform

Please, help me understand this. After running this snippet :

random_device randomEngine;
mt19937 generatorEngine(randomEngine());
uniform_real_distribution<double> unifRandomValue(
                                       numeric_limits<double>::min(), 
                                       numeric_limits<double>::max());

double test[1000];
for (int i{ 0 }; i < 1000; ++i) {
    test[i] = unifRandomValue(generatorEngine);
}

Why all the generated values are in the range [1.0E306, 1.8E308]? I was expecting random value uniformly distributed from near 0 to the max of double type.

Thanks to all




Aucun commentaire:

Enregistrer un commentaire