jeudi 22 novembre 2018

Python: Random change in list (mutation)

I'm writing a genetic algorithm and want to randomly mutate a number within a list.

If I had a list, for example:

[1,2,3,4,5]

How could I take the list and change just one of the numbers to a random numbers, for example:

[1,2,7,4,5]

or

[1,3,3,4,5]

Any help would be appreciated :)




Aucun commentaire:

Enregistrer un commentaire