First, I'm sorry bad english.
I want to generate a random number in mysql.
UPDATE articles SET rand_count = rand_count + FLOOR (RAND () * 5);
"articles" contain tens of thousands of article.
When this code operate, there were usually executed within 1~2 second.
However, since mysql's rand() function iterates tens of thousands of times, it eventually returns the same value stochastically, so all articles will have roughly the same "rand_count".
Because of this, I intended to use the current time(seconds) to distribute the first unique random number, but as I mentioned above, the execution time is so short that the same value(seconds) is eventually assigned.
Is there a way to randomly assign each unique random number of all article in mysql?
Thanks for your help.
Aucun commentaire:
Enregistrer un commentaire