feat:node-modules
This commit is contained in:
26
node_modules/mathjs/lib/cjs/function/probability/util/randomMatrix.js
generated
vendored
Normal file
26
node_modules/mathjs/lib/cjs/function/probability/util/randomMatrix.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.randomMatrix = randomMatrix;
|
||||
/**
|
||||
* This is a util function for generating a random matrix recursively.
|
||||
* @param {number[]} size
|
||||
* @param {function} random
|
||||
* @returns {Array}
|
||||
*/
|
||||
function randomMatrix(size, random) {
|
||||
const data = [];
|
||||
size = size.slice(0);
|
||||
if (size.length > 1) {
|
||||
for (let i = 0, length = size.shift(); i < length; i++) {
|
||||
data.push(randomMatrix(size, random));
|
||||
}
|
||||
} else {
|
||||
for (let i = 0, length = size.shift(); i < length; i++) {
|
||||
data.push(random());
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
Reference in New Issue
Block a user