int Width()
{
int r = 0;
r = rand();
if (r <= 3640)
{
r = (r % (10 - 1 + 1)) + 1;
printf(r);
}
}
So I have this C code here to practice using the rand() function. As I understand it the 10-1 should be the "high"-"low" for my range and then the +1 at the end should shift it into the range that I would like. The program does throw any errors though. It just crashes.
Aucun commentaire:
Enregistrer un commentaire