Hey everyone,So I'm not sure if I discovered two bugs in random_matrix or if I'm reading the documentation wrong. Firstly, in the documentation, it says:Random integer matrices. With no arguments, the majority of the
entries are -1 and 1, never zero, and rarely "large."
sage: random_matrix(ZZ, 5, 5)
[ -8 2 0 0 1]
[ -1 2 1 -95 -1]
[ -2 -12 0 0 1]
[ -1 1 -1 -2 -1]
[ 4 -4 -6 5 0]Now, it appears that there are 0's in the matrix produced. This also happens when I run the exact function above. Is this a bug in the documentation or the function?Secondly, the documentation says this about random matrices in rational fields:Random rational matrices. Now "num_bound" and "den_bound" control
the generation of random elements, by specifying limits on the
absolute value of numerators and denominators (respectively).
Entries will be positive and negative (map the absolute value
function through the entries to get all positive values), and zeros
are avoided unless the density is set. If either the numerator or
denominator bound (or both) is not used, then the values default to
the distribution for ZZ described above that is most frequently
positive or negative one.However, when I run <code>random_matrix(QQ, 10, 10)</code>, it appears all the numbers are either 0, 1, 2, -1, -2, 1/2, and -1/2. This doesn't seem to be the "most frequently positive or negative one" distribution, but instead the "uniform" one for integers. I could imagine it being such that two numbers every time with the uniform distribution as the numerator and denominator and the two are divided. Could anyone else verify this behavior?Thanks
Changing behavior would require a stronger rationale, such as bug you might discover when reviewing code and output.
Feel free to cc me if you write a patch.
Rob