若要在i ≤ R ≤ j 这个范围得到一个随机整数R ,需要用到表达式 FLOOR(i + RAND() * (j – i + 1))。

  7 -20 区间整数,i=7 j=20 (j – i + 1)=14   最终 select FLOOR(7 + RAND() * 14) as rand