Using MySQL 5.6.21 on Windows 7.
I am attempting to return a 'random' row from a table seeded by the date (so the same row returns for the current day and then switches the next day etc - a "random quote of the day generator" if you like).
I noticed the same rows keep coming up so I simplified the query to its basics, it appears the RAND() function generates very similar numbers every fourth seed value. When rounded to an integer the values appear to repeat every fourth seed. This example only uses 16 rows, but you get the idea.
create table t (i INT);
insert into t values(0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15);
select i, ceil(rand(i) * 16), rand(i) from t;
drop table t;
Gives...
0 3 0.15522042769493574
1 7 0.40540353712197724
2 11 0.6555866465490187
3 15 0.9057697559760601
4 3 0.15595286540310166
5 7 0.40613597483014313
6 11 0.6563190842571847
7 15 0.9065021936842261
8 3 0.15668530311126755
9 7 0.406868412538309
10 11 0.6570515219653505
11 15 0.907234631392392
12 3 0.15741774081943347
13 7 0.40760085024647497
14 11 0.6577839596735164
15 15 0.9079670691005579
Not what I expected, so what am I doing wrong? I expected a pseudo-random sequence to be generated.