TITLE: Generating $n\times n$ random matrix with rank $n/2$ using matlab
QUESTION [5 upvotes]: Can we  generate $n \times n$  random matrix having any desired rank?
I have to generate a $n\times n$ random matrix having rank $n/2$.
Thanks for your time and help.

REPLY [6 votes]: Generate $U,V$ random matrices of size $n \times n/2$, then almost surely $A = U \cdot V^T$ is of rank $n/2$.