Javascript Array matrixLength()
Array.prototype.matrixLength = function() { var elements = this.map(function(vector) { return vector.length; });/*w w w . ja v a 2 s . co m*/ return elements.sum(); }; function randomInt(min, max) { return Math.floor(Math.random() * (max - min)) + min; }