Faster JS implementation of rand_mat_mul.

A slightly tweaked rand_mat_mul function that uses B's transpose
to improve sequential memory access during the multiplication. This
speeds up the JS run and, I think, is a fairer comparison with
other languages which call on custom routines to do the multiplication.