jeudi 14 juillet 2016

Do std::random_device and std::mt19937 follow an uniform distribution?

I'm trying to convert this line of matlab in C++: rp = randperm(p);

Following the randperm documentation:

randperm uses the same random number generator as rand

And in rand page:

rand returns a single uniformly distributed random number

So rand follows an uniform distribution. My C++ code is based on:

std::random_device rd;
std::mt19937 g(rd());
std::shuffle(... , ... ,g);

My question is: the code above follows an uniform distribution? If not, how to do so?




Aucun commentaire:

Enregistrer un commentaire