Esempio n. 1
0
    def __init__(self, min, max):
        """
          Return a IntRange instance.

          min and max are the range boundaries.
          """
        Generator.__init__(self)
        self.offset = min
        self.delta = max - min

        self.rng = omdeRand.UniformRNG()
Esempio n. 2
0
     def __init__(self, min, max):
          """
          Return a IntRange instance.

          min and max are the range boundaries.
          """
          Generator.__init__(self)
          self.offset = min
          self.delta = max - min

          self.rng = omdeRand.UniformRNG()
Esempio n. 3
0
    def __init__(self, *list0, **dict):
        Generator.__init__(self)

        mode = "cycle"

        for key in dict.keys():
            if key == "mode":
                mode = dict["mode"]

        list0 = list(list0)
        if len(list0) == 0:
            raise ValueError, "cannot create an empty List"
        self.list = copy.deepcopy(list0)

        if mode in ["cycle", "c"]:
            self.index = 0
            self.next = self.cycle_next
        elif mode in ["swing", "s"]:
            self.index = 0
            self.step = 1
            self.next = self.swing_next
        elif mode in ["swing-repeat", "w"]:
            reversed = copy.deepcopy(list0)
            reversed.reverse()

            self.list.extend(reversed)

            self.index = 0
            self.next = self.cycle_next
        elif mode in ["heap", "h"]:
            self.index = 0
            self.next = self.cycle_next
            self.list = self.computePermutations(list0)
        elif mode in ["random", "r"]:
            self.next = self.random_next
        else:
            raise ValueError, self._value_error_message % mode
Esempio n. 4
0
     def __init__(self, *list0, **dict):
          Generator.__init__(self)

          mode = 'cycle'

          for key in dict.keys():
                if key == 'mode': mode = dict['mode']
         
          list0 = list(list0)
          if len(list0) == 0:
                raise ValueError, 'cannot create an empty List'
          self.list = copy.deepcopy(list0)

          if mode in ['cycle', 'c']:
                self.index = 0
                self.next = self.cycle_next
          elif mode in ['swing', 's']:
                self.index = 0
                self.step = 1
                self.next = self.swing_next
          elif mode in ['swing-repeat', 'w']:
                reversed = copy.deepcopy(list0)
                reversed.reverse()
                
                self.list.extend(reversed)

                self.index = 0
                self.next = self.cycle_next
          elif mode in ['heap', 'h']:
                self.index = 0
                self.next = self.cycle_next
                self.list = self.computePermutations(list0)
          elif mode in ['random', 'r']:
                self.next = self.random_next
          else:
                raise ValueError, self._value_error_message % mode
Esempio n. 5
0
    def __init__(self, alpha=0.5, beta=2.0):
        Generator.__init__(self)
        self.alpha = make_function(alpha)
        self.beta = make_function(beta)

        self.weibullvariateRNG = _WeibullvariateRNG()
Esempio n. 6
0
 def __init__(self):
     Generator.__init__(self)
     self.rng = UniformRNG()
Esempio n. 7
0
     def __init__(self, alpha = 0.5, beta = 2.0):
          Generator.__init__(self)
          self.alpha = make_function(alpha)
          self.beta = make_function(beta)

          self.weibullvariateRNG = _WeibullvariateRNG()
Esempio n. 8
0
 def __init__(self):
      Generator.__init__(self)
      self.rng = UniformRNG()