In the program below what is the difference between rand and srand? My book says that rand returns an int between 0 and RAND_MAX, which is never smaller than 32,767. Yet this code returns a number from 1-6, how is that? I see the line
( rand() % 6 ) + 1 but I don't see how that would give a number from 1-6.