Fix static random

This commit is contained in:
George Lacey 2017-09-26 16:17:31 +01:00
parent 9d2494660b
commit dcfb7f2e34

View File

@ -7,8 +7,8 @@ rand = Random()
class Individual(object): class Individual(object):
def __init__(self): def __init__(self):
self.x = rand.uniform(-100000, 100000) self.x = rand.uniform(-100, 100)
self.y = rand.uniform(-100000, 100000) self.y = rand.uniform(-100, 100)
@classmethod @classmethod
def from_params(cls, x, y): def from_params(cls, x, y):
@ -34,6 +34,6 @@ class Individual(object):
def mutate(self): def mutate(self):
if rand.randint(1, 10) % 2 == 0: if rand.randint(1, 10) % 2 == 0:
self.x = self.rand.random() self.x = rand.random()
else: else:
self.y = self.rand.random() self.y = rand.random()