mysql生成随机数,设定指定字段随机数

比如,设置num字段为1到100的随机数
update aaa set num= floor(1 + rand()*100) where 1 = 1 ;

上面rand 函数返回一个0到1之间的随机数