code: def _truncated_normal(mean,
                        stddev,
                        seed=None,
                        normalize=True,
                        alpha=0.01):
      ''' Add noise with truncnorm from numpy.
      Bounded (0.001,0.999)
      '''
      # within range ()
      # provide entry to chose which adding noise way to use
      if seed is not None:
          np.random.seed(seed)
      if stddev == 0:
          X = mean
      else:
          gen_X = truncnorm((alpha - mean) / stddev,
                            ((1 - alpha) - mean) / stddev,
                            loc=mean, scale=stddev)
          X = gen_X.rvs() + mean
          if normalize:
              # Normalize, column sum to 1
              col_sums = X.sum(1)
              X = X / col_sums[:, np.newaxis]
      return f _truncated_normal(mean,
                        stddev,
                        seed=None,
                        normalize=True,
                        alpha=0.01):
      ''' Add noise with truncnorm from numpy.
      Bounded (0.001,0.999)
      '''
      # within range ()
      # provide entry to chose which adding noise way to use
      if seed is not None:
          np.random.seed(seed)
      if stddev == 0:
          X = mean
      else:
          gen_X = truncnorm((alpha - mean) / stddev,
                            ((1 - alpha) - mean) / stddev,
                            loc=mean, scale=stddev)
          X = gen_X.rvs() + mean
          if normalize:
              # Normalize, column sum to 1
              col_sums = X.sum(1)
              X = X / col_sums[:, np.newaxis]
      return X
docs: Add noise with truncnorm from numpy.
      Bounded (0.001,0.999)