I'd like to use the std::mt19937 random number generator to produce a list of numbers between 0 and 255. "Once a number has been chosen, it should not appear again in the set." - it's this bit I don't know how to do. The mathematical term for this escapes me(!)
std::mt19937 twister; std::uniform_int_distribution<int> distribution; twister.seed(91210); distribution = std::uniform_int_distribution<int>(0,255); std::vector vNumbers; vNumbers.resize(256); for( int n = 0; n < 256; ++ n ) vNumbers[n] = distribution(twister);
std::setto get uniqueness, your numbers get sorted. I.e. if you generate57 1 9 44 102 1and store it in astd::set, you get back1 9 44 57 102. Is this acceptable? (And you keep generating untilmySet.size()==255).0-255inclusive, in some random order, correct? If so, you could fill thestd::vectorwith0 1 ... 255withstd::iota, then get random order withstd::random_shuffle.