Changeset 980

Show
Ignore:
Timestamp:
06/21/11 12:26:19 (11 months ago)
Author:
pierre
Message:

Minor bug with non uniform nor clipped distribution when launched with parallel_safe as True. The whole stuffs is slower, but correct now

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/random.py

    r957 r980  
    214214            self.rng = NumpyRNG() 
    215215         
    216     def next(self, n=1, mask_local=None): 
     216    def next(self, n=1, mask_local=None):         
    217217        """Return n random numbers from the distribution.""" 
    218218        res = self.rng.next(n=n, 
     
    228228                if len(res) == 1: 
    229229                    while not ((res > self.min_bound) and (res < self.max_bound)): 
    230                         res = self.rng.next(n=n, distribution=self.name, parameters=self.parameters) 
     230                        res = self.rng.next(n=n, distribution=self.name, parameters=self.parameters, mask_local=mask_local) 
    231231                    return res 
    232232                else: 
    233233                    idx = numpy.where((res > self.max_bound) | (res < self.min_bound))[0] 
    234234                    while len(idx) > 0: 
    235                         res[idx] = self.rng.next(len(idx), distribution=self.name, parameters=self.parameters) 
     235                        res[idx] = self.rng.next(n=n, distribution=self.name, parameters=self.parameters, mask_local=mask_local)[idx] 
    236236                        idx = numpy.where((res > self.max_bound) | (res < self.min_bound))[0] 
    237237                    return res