Re: consistent random order

Поиск
Список
Период
Сортировка
От Jeff Herrin
Тема Re: consistent random order
Дата
Msg-id 6801364.59051164821457152.JavaMail.root@srv161.carpathiahost.net
обсуждение исходный текст
Ответ на Re: consistent random order  ("Aaron Bono" <postgresql@aranya.com>)
Список pgsql-sql
I need it a little more random than that. In both these scenarios, the same items will always follow each other. <br
/><br/>Jeff<br /><br />----- Original Message -----<br />Why not create a random seed between 1 and the number of
possibilitiesin your web application when a user first hits the site, store that in the session and then increment it
by1 (do a modulus to wrap the numbers back to 1) and just select with an offset equal to this number?  That way you get
thefirst item chosen at random but the rest are sequential.  If you want this somewhat random, create a "random"
orderingfield on the table and sort by that so the pages are not sorted by name or id or whatever else it may normally
sortby. <br /><br />You could then take it further and use cookies so the next time that person comes to the site, the
"random"page picks up where it left off.<br /><br />Just an idea...<br clear="all" /><br />-- <br
/>==================================================================<br />   Aaron Bono<br />   Aranya Software
Technologies,Inc.<br />   <a href="http://www.aranya.com/" target="_blank">http://www.aranya.com</a><br />   <a
href="http://codeelixir.com/"target="_blank">http://codeelixir.com</a><br
/>================================================================== 

В списке pgsql-sql по дате отправления:

Предыдущее
От: Andreas Kretschmer
Дата:
Сообщение: Re: consistent random order
Следующее
От: Jeff Herrin
Дата:
Сообщение: Re: consistent random order