Re: What's the most efficent way to randomize a Queue?
My point is that its not a queue, then. Just take an ArrayList, use int index = Math.Random(n) where n is the # of items in your ArrayList, then index is the random index you want.
Re: What's the most efficent way to randomize a Queue?
I think you still don't get it....Say there is a queue with elements a, b and c in that order. I want to know what the best way to put the elements in a random order, so you might save the elements off to an array shuffle them, and then put them back into the queue so the new order in the queue would be b, a, c.
But keep in mind a, b, and c are just arbitrary elements if that helps you understand it....
Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.
This thread is more than three months old
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.