def generateBias(self): if ScriptLoader.RANDOMISE_SENSORS: # Distribute points cyclically between 0 and 360. self.dist = CompassValueDistribution( 0, 360, self.NEAREST_POINTS_NUMBER, self.NEAREST_POINTS_VARIANCE, Randomiser.getPortRandom(self._interactor.port_key), ) else: self.dist = CompassValueDistributionNoRandom(0, 360, 360) self.current_offset = 0 self.device_y_offset = self.NOISE_Y_OFFSET_MAX * self._interactor.random() self.noise_tick = 0 self._value = 0 self.noise = OpenSimplex(seed=Randomiser.getInstance().seeds[self._interactor.port_key]) self.calibrate()
def random(self): return Randomiser.getPortRandom(self.port_key).random()