vendredi 1 décembre 2017

Create a list not that random

My question is about creating a semi random list of letters in Python.

I want that 20% of the time, the letter is the same than 2 letters before... I dont want only random because if I do so it will not happen 20% of the time that n-2 is the same letter... I was thinking about creating a first list with the letter I want and then create a new list that will take the letter from the first list but randomly.. but I dont know how to add my constraint of 20%..

A B B C B A A C A

Like that for exemple... Do you have tips for me ?

Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire