My output is 20 random 1\'s, not between 10 and 1, can anyone explain why this is happening?
#include
#include
#include <
It's much easier to use the library correctly than rand (assuming you're familiar enough with C++ that the syntax doesn't throw you).
#include
#include
int main() {
std::random_device r;
std::seed_seq seed{r(), r(), r(), r(), r(), r(), r(), r()};
std::mt19937 eng(seed);
std::uniform_int_distribution<> dist(1, 10);
for(int i = 0; i < 20; ++i)
std::cout << dist(eng) << " ";
}