Problem with RAND in SQL

1

I'm using MySQL "5.6.38-log - MySQL Community Server (GPL)"

I have a procedure that runs every second, and it has a validation with a RAND:

WHERE t.auc_due_time < GREATEST(LEAST(TRUNCATE(12 * RAND(),0),12),2)

The problem I am facing is that it is always executing the query in 5 OR 7 in that rand, I need it to always be alternating, for example 11,9,3,5,2,7,10,11 etc. .

Why is not it working that way? Is there any other way to do this?

    
asked by anonymous 28.11.2017 / 00:46

1 answer

1

According to the MySql documentation, the RAND ([N]) function, , returns a floating point between 0 and 1.0. To obtain an integer random number R where i

28.11.2017 / 01:04