I would like to create a std::uniform_real_distribution
able to generate a random number in the range [MIN_FLOAT, MAX_FLOAT]
. Following is my code:
#include <random>
#include <limits>
using namespace std;
int main()
{
const auto a = numeric_limits<float>::lowest();
const auto b = numeric_limits<float>::max();
uniform_real_distribution<float> dist(a, b);
return 0;
}
The problem is that when I execute the program, it is aborted because a
and b
seem to be invalid arguments. How should I fix it?
Aucun commentaire:
Enregistrer un commentaire