mysql-random-data-generator
mysql-random-data-generator copied to clipboard
get_float function is buggy
function get_float(in_precision int, in_scale int) do not work properly when precision is 1 and scale is 0 i.e table data type decimal(1,0)
That's right, it occasionally go out of range. It works when the random number is within range though... not efficient but works! Will try working on the function.
mysql> select @x:=rand(), @x, @x*pow(10,1), round(@x*pow(10,1),0); +--------------------+--------------------+-------------------+-----------------------+ | @x:=rand() | @x | @x*pow(10,1) | round(@x*pow(10,1),0) | +--------------------+--------------------+-------------------+-----------------------+ | 0.9737842026853787 | 0.9737842026853787 | 9.737842026853787 | 10 | +--------------------+--------------------+-------------------+-----------------------+ 1 row in set, 1 warning (0.00 sec)