#include <ctime> int main() { srand((unsigned) time(0)); int result = 1 + (rand() % 6); // return a number between 1 and 6 }