Is it possible to set the seed for the RAND() function in MySQL? I need this for unit testing, to make sure I know what the expected outcome will be.
In PHP one would simply do:
<?php srand(12345); echo rand(); ?>
In my model I currently have a query like:
SELECT * FROM table ORDER BY RAND() LIMIT 1;
Now in my unit test I want to make sure I know what the seed for RAND() is so I know which record the query returns.
Maybe by performing an extra query before the query in my model?
I know I can just supply add an argument to RAND(), but this is not what I want; I do not want to modify the query.
PS. I am using Linux; will it help to set the seed for /dev/random maybe?