Useful query to seed a database table with random numbers. I used this for testing a support desk application:
UPDATE support_ticket SET priority = CAST((RAND() * 3)+1 AS UNSIGNED);
Where “3″ is the highest number in your range. By default, numbers range from 0-3, but in our case we needed to set the numbers from 1-4, so we set our max as 3 and add one at the end.