I've created this code that generates a random integer value each day. So today the rand() will return 3 for example each time I call it, tomorrow it generates another value instead.
time_t t = time(NULL);
tm *lt = localtime(&t);
int seed = lt->tm_mday + lt->tm_mon + 1 + lt->tm_year + 1900;
srand(seed);
dailyRand=rand();
Now i'm trying to generate a weekly rand instead, but that change on Tuesday at 00:00.
Unfortunately i didn't find any solution yet. Could someone help me?
Aucun commentaire:
Enregistrer un commentaire