def CreateDevice(self): xPos = 0 yPos = 0 xBias = 0 yBias = 0 location = random.randint(0, 3) if (location % 2 == 0): xPos = random.randint(0, self.columns - 1) top = random.randint(0, 1) if (top): yBias = random.random() * 2 else: yBias = random.random() * -2 else: yPos = random.randint(0, self.rows - 1) right = random.randint(0, 1) if (right): xBias = random.random() * -2 else: xBias = random.random() * 2 device = Device(xPos, yPos, True) device.SetBias(xBias, yBias) self.devices.append(device) self._deviceCount += 1 return device