generateIndexMatrix function
Implementation
Tensor<Matrix> generateIndexMatrix(int rows, int cols, int maxIndex) {
Random random = Random();
Matrix m = [];
for (int i = 0; i < rows; i = i + 1) {
Vector row = [];
for (int j = 0; j < cols; j = j + 1) {
row.add((random.nextDouble() * (maxIndex - 1)).roundToDouble());
}
m.add(row);
}
return Tensor<Matrix>(m);
}