lundi 29 août 2016

How to generate random number between 0 and 1 in genetic algorithm toolbox, Deap, Python

I am using genetic algorithm toolbox in Python. The code: toolbox.register("attr_bool", random.randint, 0, 1) usually defines random numbers of 0 and 1 to be generated. The question is that I am looking for random numbers between 0 and 1. I used toolbox.register("attr_bool", random.uniform(0, 1)), but it takes me the below error: TypeError: the first argument must be callable




Aucun commentaire:

Enregistrer un commentaire