by foobar2020 · 11y ago · 0 comments
But yes, in general the rand-modulo pair is an anti-pattern.
In the specific case of mt_rand, MIN_RAND is 0 by default, then the modulus needs to divide (MAX_RAND + 1).
In the general case, there's no rule in any uniform continuous implementation of rand such as (modulus + 1) needs to divide a specific number.