the code i have provided below generates a random ID for an electorate. For example, the random generator may set the ID to 5, 10 or 100. My question today is, how can I produce a number of random IDs based on the paramater value numberofIDs. So, for example if the entered number is 5 then 5 random IDs are created, if it 2 then 2 random IDs are created.
int Electrorates::assignID(int numberofIDs) { //function to generate an x ammount of electorates, depending on the argument
std::random_device random_device;
std::default_random_engine generator(random_device());
std::normal_distribution<double> distribution(0,1); //create a random device to set the ID
int randomID = distribution(generator);
setelectorateID(randomID); //access function to set ID
}
Thankyou, if any futher code is needed please feel free to ask
Aucun commentaire:
Enregistrer un commentaire