This content has been marked as final. Show 4 replies
One way is to create an array with the numbers in question, and then randomly select an index within that array and remove that item. Then keep repeating until the array is empty.
Push your Values inside an Array and use the sort function to create shuffled array
This will generate shuffled array without repeated elements
Thanks, I will try it..
I recently ran into this issue. There is a simple solution which guarantees that there is no single repetition, but you could easily loop a certain pattern randomly.
this basically ensures that the value for the random number will not be assigned the same value as the previous iteration.
let me know if there are any issues with this code.