VY
as an operand and does nothing with it xd What's
would be a questionrand()
is usually not very good at having a flat distribution), but not exactly uniform because 256 does not divide RAND_MAX
evenly rand()
is a prng, it is deterministicrand()
solely depends on the seed you give it with srand()
and the times you call rand()
rand()
until you get a number inside the range divisible by n (for small n it's usually just one iteration anyway), then doing the modulo n)rand()
until you get a number inside the range divisible by n (for small n it's usually just one iteration anyway), then doing the modulo n) rand()
until you get a number inside the range divisible by n (for small n it's usually just one iteration anyway), then doing the modulo n) rand() & 0XFF
?RAND_MAX
is divisible by 256RAND_MAX + 1
you need to divide completely