My problem is a bit more complicated than what is asked with the question of the threat. I am trying to pick a random word from a database everytime i "roll the dice". And on a second occasion, i will need to pick groups of 25 words from the same database randomly again and then I will even need to shuffle them and make new groups of 25 out of them. So yes I read a few old threats and some tutorials but it didn't help me at all. Problem is, I need something that will always give me a different word. If I use NEWID and pick a different word from the db, next time i will need to do the same again and there is a chance that same word will pop out.
I tried to use a datareader but it didn't go well. So I switched to a dataset. Everything is fine, I get the rows to a dataset and I generate a random number with a min-max value same as the rowcount of the dataset. Problem is, I can not pick a random row out of the dataset. I could set this to the unique id of the table but then again the unique id section has deleted records so there are some missing and naturally some of them are bigger numbers than the count of the rows.
Is there a more elegant way to do this? Something that can help me get my rows, assign them some numbers, perhaps indexes, then get a random number from a pool exactly same as their count, and match a random number with the rows index/line w/e to get a unique word each time. I can then substitute the already picked rows and this way there will be no recurring attendances.
I've been trying this since the morning and its been more than 12.5 hours so my brain is jelly right now. Perhaps I have entered a zone above my head as I am not a coder, just working on a small project out of necessity. Any help would be appreciated but please explain as you would to a toddler because.. you know, jelly brain... :)
Thanks in advance.
What I have tried:
I have tried using a datareader but datareader was reading forward so it was impossible to shuffle or randomize a complete content. I switched to dataset but I simply can not pick a row out of it. Rows do not have a number which I can use the single out them. I'm all confused now.