A Student-T random variate
    
    Parameters
    ----------
    v : int
        The degrees of freedom of the distribution (must be greater than one)
773166
def StudentT(v, tag=None):
    
    assert int(v) == v and v >= 1, 'Student-T "v" must be an integer greater than 0'
    return uv(ss.t(v), tag=tag)
786159
def _sample_weight(kappa, dim):
    
    dim = dim - 1  # since S^{n-1}
    b = dim / (np.sqrt(4. * kappa ** 2 + dim ** 2) + 2 * kappa)
    x = (1. - b) / (1. + b)
    c = kappa * x + dim * np.log(1 - x ** 2)

    while True:
        z = np.random.beta(dim / 2., dim / 2.)
        w = (1. - (1. + b) * z) / (1. - (1. - b) * z)
        u = np.random.uniform(low=0, high=1)
        if kappa * w + dim * np.log(1. - x * w) - c >= np.log(u):
            return w
1204850
def probability_density(self, X):
        
        self.check_fit()

        U, V = self.split_matrix(X)

        if self.theta == 0:
            return np.multiply(U, V)

        else:
            num = np.multiply(np.multiply(-self.theta, self._g(1)), 1 + self._g(np.add(U, V)))
            aux = np.multiply(self._g(U), self._g(V)) + self._g(1)
            den = np.power(aux, 2)
            return num / den
326373
def posterior(self, x, s=1.):
        """"""
        pr0 = 1. / self.sigma**2  # prior precision
        prd = x.size / s**2  # data precision
        varp = 1. / (pr0 + prd)  # posterior variance
        mu = varp * (pr0 * self.mu + prd * x.mean())
        return TruncNormal(mu=mu, sigma=np.sqrt(varp), a=self.a, b=self.b)
1312062
function maxV(v) {
         return this._set(this.x > v.x ? this.x : v.x, this.y > v.y ? this.y : v.y);
       }
1100857
def random_unit(size=3):
    
    while True:
        result = np.random.normal(0, 1, size)
        length = np.linalg.norm(result)
        if length > 1e-3:
            return result/length
68527
def estimate_gaussian(X):
    
    mean = np.mean(X,0)
    variance = np.var(X,0)
    return Gaussian(mean,variance)
820180
private static void randomGaussian( Random rand , double sigma , int radius , Point2D_I32 pt ) {

		int x,y;

		while( true ) {
			x = (int)(rand.nextGaussian()*sigma);
			y = (int)(rand.nextGaussian()*sigma);
			if( Math.sqrt(x*x + y*y) < radius )
				break;
		}

		pt.set(x,y);
	}
571925
function randomAxis(v) {
    v = v || new Vector3();

    v.x = Math$1.randFloatSpread(2.0);
    v.y = Math$1.randFloatSpread(2.0);
    v.z = Math$1.randFloatSpread(2.0);
    v.normalize();

    return v;
  }
1259617
def probability_density(self, X):
        
        self.check_fit()

        U, V = self.split_matrix(X)

        a = (self.theta + 1) * np.power(np.multiply(U, V), -(self.theta + 1))
        b = np.power(U, -self.theta) + np.power(V, -self.theta) - 1
        c = -(2 * self.theta + 1) / self.theta
        return a * np.power(b, c)
823246
def random(cls):
        
        r1, r2, r3 = np.random.random(3)

        q1 = sqrt(1.0 - r1) * (sin(2 * pi * r2))
        q2 = sqrt(1.0 - r1) * (cos(2 * pi * r2))
        q3 = sqrt(r1)       * (sin(2 * pi * r3))
        q4 = sqrt(r1)       * (cos(2 * pi * r3))

        return cls(q1, q2, q3, q4)
607042
@Override
	public RandomVariableInterface getVolatility(int timeIndex, int component) {
		synchronized (volatility) {
			if(volatility[timeIndex][component] == null) {
				volatility[timeIndex][component] = randomVariableFactory.createRandomVariable(getTimeDiscretization().getTime(timeIndex), volatilityMatrix[timeIndex][component]);
			}
		}

		return volatility[timeIndex][component];
	}
420908
function gaussRandom() {
  if (gaussRandom.returnV) {
    gaussRandom.returnV = false;
    return gaussRandom.vVal;
  }
  var u = 2 * Math.random() - 1;
  var v = 2 * Math.random() - 1;
  var r = u * u + v * v;
  if (r == 0 || r > 1) {
    return gaussRandom();
  }
  var c = Math.sqrt(-2 * Math.log(r) / r);
  gaussRandom.vVal = v * c; // cache this
  gaussRandom.returnV = true;
  return u * c;
}
595792
function randn() {
  var u, v, s;
  do {
    u = Math.random() * 2 - 1;
    v = Math.random() * 2 - 1;
    s = u * u + v * v;
  } while (s >= 1 || s == 0);
  s = Math.sqrt(-2 * Math.log(s) / s);
  return u * s;
}
709417
def _optm(x, alpha, mu, sigma):
    '''
    '''
    return ss.skewnorm.pdf(x, alpha, mu, sigma)
968978
def pick(self):
        
        v = random.uniform(0, self.ub)
        d = self.dist
        c = self.vc - 1
        s = self.vc
        while True:
            s = s / 2
            if s == 0:
                break
            if v <= d[c][1]:
                c -= s
            else:
                c += s
                # we only need this logic when increasing c
                while len(d) <= c:
                    s = s / 2
                    c -= s
                    if s == 0:
                        break
        # we may have converged from the left, instead of the right
        if c == len(d) or v <= d[c][1]:
            c -= 1
        return d[c][0]
420969
def degrees_of_freedom(self):
        
        if len(self._set_xdata)==0 or len(self._set_ydata)==0: return None
        
        # Temporary hack: get the studentized residuals, which uses the massaged data
        # This should later be changed to get_massaged_data()
        r = self.studentized_residuals()
        
        # Happens if data / functions not defined
        if r == None: return
        
        # calculate the number of points
        N = 0.0
        for i in range(len(r)): N += len(r[i])
        
        return N-len(self._pnames)