-
I understand the basic of your shuffle algorithm. Just not sure how to actually implement it in a loop etc. At the end of the equation, you get a line that is: return(si); Is 'si' a single index, and then looping through the equation continues to give single non-repeating index numbers until the index is complete? And then after that you would need to re-seed the equation with a random to begin a new list? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
An expected use would be within a game or for the playing of media. Either of which you would select an item periodically, not all at once. So first you would pick a ShuffleID (this would be an arbitrary pseudo random value which represents and dictates the shuffle). Then you get a "Shuffled Index" (si) each time you call the MillerShuffleAlgo function with a reference index (inx) which you would do each time a BlackJack player says "hit me" or a music stream listener needs the next song. For instances with MillerShuffle(inx++, mySID, myListSize); |
Beta Was this translation helpful? Give feedback.
-
BTW: you don't really Have to pick a new ShuffleID at any time, as the code now effectively uses a new ShuffleID if the reference index used overflows a multiple of the listSize. This is sort of an auto shuffler feature for those who don't want to be bothered. What you get is basically the same as if you reshuffled after each use of reference indexes of 0 to n-1 (but you go on & on well beyond n) |
Beta Was this translation helpful? Give feedback.
An expected use would be within a game or for the playing of media. Either of which you would select an item periodically, not all at once. So first you would pick a ShuffleID (this would be an arbitrary pseudo random value which represents and dictates the shuffle). Then you get a "Shuffled Index" (si) each time you call the MillerShuffleAlgo function with a reference index (inx) which you would do each time a BlackJack player says "hit me" or a music stream listener needs the next song. For instances with MillerShuffle(inx++, mySID, myListSize);
The reference indexes would normally be used sequentially starting at 0 and going up to listsize-1, but don't have to be. You could iterate thr…