I have a logic problem concerning running a random search between two numbers to shuffle items on my web page. I do a query to my db and receive the row id's for certain data. What i want to do is find randomly place the items ion my page each time a user comes to my page so that it looks fresh each time. The logic has to find each row randomly and place it on the page only once.
So let's say I retrieve the id's 2, 4, 5, 6, and 9. I want to display its data randomly each time. I thought about placing the id's in an array and then running the random function between the lowest and highest numbers - marking each off when they are discovered. But I think that could take a long time if the number of retrieved id were to grow - finding each number randomly would take a while for the page to load.
Does anyone understand what i am trying to do here and can anyone help?
Random sort issue (page shuffle
Moderator: General Moderators
Re: Random sort issue (page shuffle
Do it in DB layer - use ORDER BY RAND() and LIMIT
There are 10 types of people in this world, those who understand binary and those who don't