Okay, I found lots of posts on SO about how to pull a RANDOM item from the database when using LINQ. There seems to be a couple of differnet ways to handle this. What I need to do though is pull a RANDOM item from the database that the user has not seen before.
The data I am pulling from the database is very small. Is there any way I can just hit the database once for 1000 records and then randomly scroll through those?
Should I put a cookie on the users system recording the IDs of which items they have seen, pull a random record, check to see if it is seen and if so, pull from the database again? That seems like performance issues just waiting to happen.
I don't expect anyone to c开发者_如何学Code it for me, I am just looking for concepts and pointing in the right direction of how I should go about this.
Need more details? Just let me know!
The usual answer to this question is to create a randomly ordered list and scroll through it linearly. So you'd pull
a, b, c, d, e, f
re-sort it using a randomization algorithm to
b, e, f, a, c, d
and then just do a linear walk.
精彩评论