1 2 3 4 5 6 7 8 9 10 11
#include <stdlib.h> #include <time.h> #include "dice.h" void _dice::init() { srand((unsigned)time(NULL)); } int _dice::get_val() { return rand() % 6 + 1; }