Пример #1
0
 def generate(self):
     """Generate a random float number between the biased range lowerLimit and upperLimit."""
     # get position
     position = self.lowerLimit + self.__binWidth*np.searchsorted(self.__scheme, generate_random_float()*self.__scheme[-1]) + self.__halfBinWidth
     # find limits
     minLim = max(self.lowerLimit, position-self.__halfBinWidth)
     maxLim = min(self.upperLimit, position+self.__halfBinWidth)
     # generate number
     return minLim+generate_random_float()*(maxLim-minLim) + self.__halfBinWidth    
Пример #2
0
 def generate(self):
     """Generate a random intger number between the biased range lowerLimit and upperLimit."""
     index = np.int( np.searchsorted(self.__scheme, generate_random_float()*self.__scheme[-1]) )
     return self.lowerLimit + index
Пример #3
0
 def generate(self):
     """Generate a random float number between lowerLimit and upperLimit."""
     return np.float(self.__lowerLimit+generate_random_float()*self.__rang)