OK, regarding the RAND_INT macro...
I was aware that it could fail under extreme circumstances, both when a strange argument (e.g. 4+4) is used, and when RAND_MAX is returned.
Regarding the first case, it's true that you need to protect arguments and understand how macros evaluate arguments. I didn't here, because I only used the macro here to switch between the built-in random number generator and my own, for debugging this problem.
Regarding the second case, that formula is only used with the built-in random number generator; my own protects against that case. It's all in Stroustrup3e section 22.7. (If you wade through his later code, you'll see it's linear congruential, and it protects against that case.)
Stroustrup gives that formula as yielding adequate results under most circumstances, and my bug isn't that I'm suddenly hitting RAND_MAX within a few calls to rand(). (Consider, if so, why it wouldn't happen in debug builds?) I wonder if Stroustrup may address that failing of that formula in later printings (I have the first printing, I was keenly awaiting that book).
BTW you don't want to simply add 1 to your max compenstate for that failing because that will throw off your uniform random distribution.
The traditional reason for using a formula such as this, and not modulus, is that with linear congruential sequences (which is what rand uses to generate pseudorandom numbers) have not-as-random lower bits (which is what modulus uses). For more info, web search for the online copy of Numerical Recipes in C Second Edition, there is a chapter on random number generation that's very interesting (to nerds like us).
So you are both right, but I am aware of these issues and they exist only in this code for reproducing the problem.
For a limited time, you can get a copy of the project here: http://www.scalenesoftware.com/Minimal- ... -Error.zip