1
I am using Mysql "5.6.38-log - Mysql Community Server (GPL)"
I have a trial that runs every second, and in 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 running the query in 5 OR 7 in this Rand, I need it to be always alternating, for example 11,9,3,5,2,7,10,11 etc..
Why isn’t it working that way? Is there some other way to do this?
In case it would be that way for an interval of 2 to 12?
WHERE t.auc_due_time < FLOOR(2 + (RAND() * 10));
– Wendler
That’s right there.
– Pablo Tondolo de Vargas
Well, I did it that way, but it doesn’t seem to work either. Just to clarify better, it is running along with a regressive chronometer of 15 seconds, then I need it to execute the query in the seconds of 2 to 12 alternating always...
– Wendler
I made an issue in my reply
– Pablo Tondolo de Vargas
thanks for the reply.. And how would it be to do between 1 and 12?
– Wendler
would just put
SELECT FLOOR(1 + (RAND() * 11));
– Pablo Tondolo de Vargas
How can I change this command so that it randomly generates the numbers and the number 1 appears more frequently?
– Wendler