perturb#

perturb(n=1, span=0.5, randseed=None, normal=False)[source]#

Define an array of numbers uniformly perturbed with a mean of 1.

Parameters:
  • n (int) – number of points

  • span (float) – width of distribution on either side of 1

  • randseed (int) – seed passed to the reseed numpy’s legacy MT19937 BitGenerator

  • normal (bool) – whether to use a normal distribution instead of uniform

Example:

sc.perturb(5, 0.3) # Returns e.g. array([0.73852362, 0.7088094 , 0.93713658, 1.13150755, 0.87183371])

New in version 3.0.0: Uses a separate random number stream