make sure RAND_MAX is a proper value