-- For range (min..max( (min inclusive, max exclusive) it is: FLOOR( RAND() * (max-min) + min ) -- For range (min..max) (min+max inclusive) it is: FLOOR( RAND() * (max-min+1) + min )