#include <vector>
#include <random>
using namespace std;
int main()
{
vector<int> coll{1, 2, 3, 4};
shuffle(coll.begin(), coll.end(), random_device{});
default_random_engine dre{random_device{}()};
shuffle(coll.begin(), coll.end(), dre);
}
Question 1: What's the difference between
shuffle(coll.begin(), coll.end(), random_device{});
and
shuffle(coll.begin(), coll.end(), dre);
?
Question 2: Which is better?
Aucun commentaire:
Enregistrer un commentaire