C++, random number w/ range of 1-6

This is a simple example to generate randoms between 1 to 6, I think you can figure the rest

#include <iostream>
#include <cstdlib>
#include <ctime>

int main() {
    srand(time(0));
    std::cout << (rand() % 6 + 1) <<std::endl;
    return 0;
}

Leave a Comment