dimanche 14 juin 2020

Select random elements with guaranteed spacing before choosing the same element again

I want to select random elements from a list without the possibility of repeating the same element twice in a row. I want to have a guaranteed amount of other elements between choosing the same element again. Additionally it has to be impossible to 100% predict what the next choice will be.

My current solution is to select elements at random until I selected one third of the total elements. Then I randomly select half of the the other elements to get another third. After that I add the first third back to the remaining elements and repeat the process.

This way I have a guaranteed distance of 1/3 of the total elements before repeating an element. But, I would like to have an even larger spacing. Is there any way to achieve this without making the choice predictable?




Aucun commentaire:

Enregistrer un commentaire