set return value when reading random bytes

refs #237