Khan/khan-exercises — pull request #8321 by Sligo (2011-12-11 00:42:47+00:00)
Title: Modified randRange() to allow creation of matrices

I just made a few modifications to the randRange() function in math.js to allow it to be used to create two dimensional arrays of random numbers, rather than just the one dimensional arrays that it can currently create. This should be useful for exercises in Linear Algebra requiring the creation of matrices.

It should work exactly the same as before if only two or three arguments are passed, but in this new version, if a fourth argument is passed, it will create a matrix with a number of columns equal to the third argument, and a number of rows equal to the fourth argument.

I couldn't work out how to get it to work with jquery.map, so I used for loops instead to create the matrix. If it would be better to do it with jquery.map, and you know how to do it, just let me know how and I'll fix it.

Any suggestions would be appreciated.