fix random number bug (with {max: 0})