from one of my
C class handouts
(see exercise 8)
for the various +1 ``fudge factors''
in code fragments like those of this question's answer
long article of mine
laying the groundwork for this question's answer
long message of mine
further explaining the ``fudge factors'' and derivations
by Lawrence Kirby
including sample code and discussion of the case
when N is close to RAND_MAX.
about this FAQ list