0

I'm using the JAMA package to generate a bunch of random vectors. Although it generates a random number for the element in each row, it repeats this same vector 100 times. How do I generate different values for each vector?

public static Matrix[] hundredVectors() { //generate 100 random init vectors
    Matrix[] storage = new Matrix[100]; //where all vectors are stored
    double[][] nums = new double[3][1]; //init vector
    for (int i = 0; i < 100; i++) {
        for (int j = 0; j < 3; j++) {
            nums[j][0] = Math.random();
            storage[i] = new Matrix(nums);
        }
    }
    return storage;
}
as1216
  • 1,194
  • 2
  • 8
  • 11

0 Answers0