public static Vector Rand(int n) { double[] x = new double[n]; for (int i = 0; i < n; i++) { x[i] = MLRandom.GetUniform(); } return(new Vector(x)); }
public static Vector NormRand(int n, double mean = 0, double stdDev = 1, int precision = -1) { double[] x = new double[n]; for (int i = 0; i < n; i++) { if (precision > -1) { x[i] = System.Math.Round(MLRandom.GetNormal(mean, stdDev), precision); } else { x[i] = MLRandom.GetNormal(mean, stdDev); } } return(new Vector(x)); }
public static Matrix NormRand(int n, int d, int min = 0) { var m = new double[n][]; for (int i = 0; i < n; i++) { m[i] = new double[d]; for (int j = 0; j < d; j++) { m[i][j] = MLRandom.GetNormal() + min; } } return(new Matrix { _matrix = m, _asTransposeRef = false, Cols = d, Rows = n }); }