Let's not forget to actually define RAND_MAX...