Modifies the Distance up to +-10%
761473
protected double slightlyModifyDistance(double distance) {
        double distanceModification = random.nextDouble() * .1 * distance;
        if (random.nextBoolean())
            distanceModification = -distanceModification;
        return distance + distanceModification;
    }
1028794
def change_length(self, parameter, value):
        
        """

        self.preamble.append(UnsafeCommand('setlength',
                                           arguments=[parameter, value]))
1217208
def as_percent(self, precision=2, *args, **kwargs):
        
        f = Formatter(as_percent(precision), args, kwargs)
        return self._add_formatter(f)
656530
private void enlargeOffset() {
	if (offset == 0) {
	    offCount = offCount == 0 ? 1 : offCount * 2;
	    offset = offCount;
	    Object[] narr = new Object[arr.length + offset];
	    for (int i = 0; i < size; i++) {
		narr[offset + i] = arr[i];
	    }
	    arr = narr;
	}
    }
52747
def _advance_window(self):
        """"""
        x_to_remove, y_to_remove = self._x_in_window[0], self._y_in_window[0]

        self._window_bound_lower += 1
        self._update_values_in_window()
        x_to_add, y_to_add = self._x_in_window[-1], self._y_in_window[-1]

        self._remove_observation(x_to_remove, y_to_remove)
        self._add_observation(x_to_add, y_to_add)
608010
def distance(other)
      @globe.inverse(phi, la, other.phi, other.la).first
    end
1292418
function() {
        var invLen = 1 / vec3.len(this.normal.array);
        vec3.scale(this.normal.array, invLen);
        this.distance *= invLen;
    }
1360086
def fix(self, with_margin=True):
        """"""
        if not self.width:
            self.xmax = self.xmin + 1
        if not self.height:
            self.ymin /= 2
            self.ymax += self.ymin
        xmargin = self.margin * self.width
        self.xmin -= xmargin
        self.xmax += xmargin
        if with_margin:
            ymargin = self.margin * self.height
            self.ymin -= ymargin
            self.ymax += ymargin
863459
function addStateModifier() {
    var modifier = new StateModifier({
        size: [undefined, 100],
        align: [0.7, 0.5],
        origin: [0.5, 0.5],
        proportions: [0.2, 1],
        opacity: 0.5
        //transform: Transform.thenMove(Transform.rotateZ(Math.PI / 3), [200, 50, 0])
    });

    modifier.setAlign(
        [0.5, 0.5],
        { duration: 1000, curve: Easing.inExpo },
        function() {
            modifier.setTransform(
                Transform.thenMove(Transform.rotateZ(Math.PI / 3), [50, 50, 0]),
                { duration: 800, curve: Easing.inExpo }
            );
        }
    );

    var surface = new Surface({
        content: 'HI',
        properties: {
            backgroundColor: 'red',
            color: 'white',
            textAlign: 'center',
            fontSize: '40px',
            borderRadius: '10px'
        }
    });

    ctx.add(modifier).add(surface);
}
1175535
function (percent) {
            var rounded = Math.round(percent / this.coords.p_step) * this.coords.p_step;

            if (rounded > 100) {
                rounded = 100;
            }
            if (percent === 100) {
                rounded = 100;
            }

            return this.toFixed(rounded);
        }
854784
function edit_distance(a, b) {
  // create a 2 dimensions array
  const m = a.length;
  const n = b.length;
  const dp = new Array(m + 1);
  for (let i = 0; i <= m; i++) {
    dp[i] = new Array(n + 1);
  }

  // init dp array
  for (let i = 0; i <= m; i++) {
    dp[i][0] = i;
  }
  for (let j = 0; j <= n; j++) {
    dp[0][j] = j;
  }

  // dynamic approach
  for (let i = 1; i <= m; i++) {
    for (let j = 1; j <= n; j++) {
      if (a[i - 1] !== b[j - 1]) {
        dp[i][j] = triple_min(
          1 + dp[i - 1][j], // deletion
          1 + dp[i][j - 1], // insertion
          1 + dp[i - 1][j - 1], // replacement
        );
      } else {
        dp[i][j] = dp[i - 1][j - 1];
      }
    }
  }
  return dp[m][n];
}
710217
private function setShadowDistance($distance)
    {
        if ($distance !== null) {
            $this->shadowProperties['distance'] = (string) $this->getExcelPointsWidth($distance);
        }

        return $this;
    }
729899
def setMaximum( self, value ):
        
        super(XRatingSlider, self).setMaximum(value)
        
        self.adjustMinimumWidth()
890309
def adjust!(other)
      @x0 = other.x0 if other.x0 < @x0
      @y0 = other.y0 if other.y0 < @y0
      @x1 = other.x1 if other.x1 > @x1
      @y1 = other.y1 if other.y1 > @y1
    end
1200814
private void applyHorizontalLimit()
    {
        if (mover.getX() < limitLeft && limitLeft != Integer.MIN_VALUE)
        {
            mover.teleportX(limitLeft);
        }
        else if (mover.getX() > limitRight && limitRight != Integer.MAX_VALUE)
        {
            mover.teleportX(limitRight);
        }
    }
971440
def add(direction, count, distance)
      count = direction.downcase == 'b' ? -count.to_i : count.to_i

      case distance
      when 'd'
        @now + count
      when 'w'
        @now + count * 7
      when 'm'
        @now >> count
      when 'y'
        @now >> count * 12
      end

    end
621933
private void adjustApproximatedKNNDistances(MkAppEntry entry, Map<DBID, KNNList> knnLists) {
    MkAppTreeNode<O> node = getNode(entry);

    if(node.isLeaf()) {
      for(int i = 0; i < node.getNumEntries(); i++) {
        MkAppLeafEntry leafEntry = (MkAppLeafEntry) node.getEntry(i);
        // approximateKnnDistances(leafEntry,
        // getKNNList(leafEntry.getRoutingObjectID(), knnLists));
        PolynomialApproximation approx = approximateKnnDistances(getMeanKNNList(leafEntry.getDBID(), knnLists));
        leafEntry.setKnnDistanceApproximation(approx);
      }
    }
    else {
      for(int i = 0; i < node.getNumEntries(); i++) {
        MkAppEntry dirEntry = node.getEntry(i);
        adjustApproximatedKNNDistances(dirEntry, knnLists);
      }
    }

    // PolynomialApproximation approx1 = node.knnDistanceApproximation();
    ArrayModifiableDBIDs ids = DBIDUtil.newArray();
    leafEntryIDs(node, ids);
    PolynomialApproximation approx = approximateKnnDistances(getMeanKNNList(ids, knnLists));
    entry.setKnnDistanceApproximation(approx);
  }