Fix static random
This commit is contained in:
parent
9d2494660b
commit
dcfb7f2e34
|
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user