Could someone help me with generating random numbers between 0-71 while also guarantee it WILL cover all numbers from 0 to 71 inclusively?
I have tried the following, but some numbers appear more than once and some don't appear at all.
int max= 71;
int min= 0;
std::random_device engine;
//initialise to -1 to make sure numbers are generated and stored properly
int randomNum = -1;
while(max> 0){
std::uniform_int_distribution<int> randomDistributed(min,max);
randomNum = randomDistrubuted(engine);
std::cout << randomNum << ", ";
max--;
}
UPDATE: This problem was raised as I intend to generate random numbers so I could shuffle my own implementation of LinkedList data structure. I wished to achieve this by creating a new list and add elements from oldList->get(randomNumber) element to the new shuffled list. Code above should actually be sufficient to achieve this, as previously mentioned last sentence before the current sentence.