I'm using a query like:
SELECT * FROM items ORDER BY RANDOM()
All is well if the number of rows is low. In my tests however, I would like to have something reproducible to verify. This is why I'm seeding the random number generator:
SELECT setseed(0.123);
SELECT * FROM items ORDER BY RANDOM();
It's nice and working well. It looks like the order is same time on each execution. Except that it's not completely reproducible. In some cases, the test succeeds and I get the expected order and result. In some execution of the same test, I don't. Why is that?
Aucun commentaire:
Enregistrer un commentaire