Making sure to utilize return value of read() in random number generation