I have a function to generate numbers between 0-255 but rand() is also generating negative values. Any advice, please.
char* generateRandomNumbers()
{
static unsigned char random[9];
srand(0);
static int i = 0;
for(;i<9;i++)
{
random[i] = rand() % (256);
}
return (char*)random;
}
Aucun commentaire:
Enregistrer un commentaire