i am reading high quality 16 bit random numbers of type uint16_t from /dev/random
and i am getting numbers as big as: 2936814755. Are these correct
int myFile = open("/dev/random", O_RDONLY);
unsigned int rand;
uint16_t randomNum = read(myFile, &rand, sizeof(rand)) ;
printf(" %u ", rand);
close(myFile);
unsigned int probably isn’t 16 bit on your pc architecture. If you want to be sure use uint16_t instead.
I think you were confusing the return value of read (ret that should be int and is the numbers of bytes read) and the generated random number (rand that should be uint16_t and is the random number generated).