Question: "Random" matrices are all the same

I'd like to generate several random matrices within the same question. If I put this code under "Algorithm", both matrices are the same (although they both change to a new matrix if you refresh the question):

$A=maple("randomize():LinearAlgebra[RandomMatrix](2,2,generator=rand(-9..9))");
$B=maple("randomize():LinearAlgebra[RandomMatrix](2,2,generator=rand(-9..9))");
$displayA=maple("printf(MathML:-ExportPresentation($A))");
$displayB=maple("printf(MathML:-ExportPresentation($B))");

The workaround I have found is to change the generator for the B matrix to -8..8, or to generate the entries for the matrices using rint commands and then create the matrix by passing in those random numbers. However, this gets tedious with 5x5 matrices.

 

Please Wait...