For some reason I keep getting 6 every time. I know of another way to do a random dice roll, but I wanted to learn how to use the deafult_random_engine. thanks a bunch, Mike
#include <iostream>
#include <string>
#include <random>
#include <ctime>
using namespace std;
int main()
{
default_random_engine randomGenerator(time(0));
uniform_int_distribution<int> diceRoll(1, 6);
cout << "You rolled a " << diceRoll(randomGenerator) << endl;
}
Aucun commentaire:
Enregistrer un commentaire