code: def addDiscreteOutcomeConstantMean(distribution, x, p, sort = False):
      '''
      Adds a discrete outcome of x with probability p to an existing distribution,
      holding constant the relative probabilities of other outcomes and overall mean.
      Parameters
      ----------
      distribution : [np.array]
          Two element list containing a list of probabilities and a list of outcomes.
      x : float
          The new value to be added to the distribution.
      p : float
          The probability of the discrete outcome x occuring.
      sort: bool
          Whether or not to sort X before returning it
      Returns
      -------
      X : np.array
          Discrete points for discrete probability mass function.
      pmf : np.array
          Probability associated with each point in X.
      Written by Matthew N. White
      Latest update: 08 December 2015 by David Low
      '''
      X   = np.append(x,distribution[1]*(1-p*x)/(1-p))
      pmf = np.append(p,distribution[0]*(1-p))
      if sort:
          indices = np.argsort(X)
          X       = X[indices]
          pmf     = pmf[indices]
      return([pmf,X])