fixed rand but when min or max is 0. 

max should never be 0, but for consistency I updated both checks.