@Override public double rand() { double x = 0.0; for (int i = 0; i < nu; i++) { double norm = GaussianDistribution.getInstance().rand(); x += norm * norm; } return x; }
/** * Constructor. */ @SuppressWarnings("unchecked") Hash() { a = new double[k][d]; b = new double[k]; for (int i = 0; i < k; i++) { for (int j = 0; j < d; j++) { a[i][j] = GaussianDistribution.getInstance().rand(); } b[i] = Math.random(0, w); } LinkedList<Item> list = new LinkedList<>(); table = (LinkedList<Item>[]) java.lang.reflect.Array.newInstance(list.getClass(), H); }
@Override public double rand() { if (gaussian == null) { gaussian = new GaussianDistribution(mu, sigma); } return Math.exp(gaussian.rand()); }
/** * Returns a random matrix of normal distributed values with given mean and standard dev. */ public static DenseMatrix randn(int rows, int cols, double mu, double sigma) { DenseMatrix a = zeros(rows, cols); GaussianDistribution g = new GaussianDistribution(mu, sigma); for (int j = 0; j < cols; j++) { for (int i = 0; i < rows; i++) { a.set(i, j, g.rand()); } } return a; }
double[] Yi = Y[i]; for (int j = 0; j < d; j++) { Yi[j] = gaussian.rand();
for (int i = 0; i < p; i++) { for (int j = 0; j < n; j++) { proj[i][j] = gauss.rand();