The default rand() function is not truly random—instead, use the Mersenne Twister generator:
#include <iostream>
#include <random>
int main() {
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<int> dist(1, 6);
for (int i = 0; i < 6; ++i) {
std::cout << dist(gen) << " ";
}
return 0;
}
Provides better randomness than rand().