How can we randomly generate matrix $A \in \mathbb{R}^{n \times m}_{\geq 0}$ that satisfies
$A 1_n = m1$ and $A^T 1_m = n1$.
How can we randomly generate matrix $A \in \mathbb{R}^{n \times m}_{\geq 0}$ that satisfies
$A 1_n = m1$ and $A^T 1_m = n1$.
I don't know if this is what you want, but here are two differnet ways:
In the case $m=n$: Generate a bunch of random permutation matrices $A_i$ and take a random linear combination $\sum_i \alpha_i A_i$ with $\sum \alpha_i=n$ and $\alpha_i\geq 0$.
Generate a random $m\times n$ matrix and use the Sinkhorn scaling algorithm the equalize row and column sums to the desired values.
This is an example of generating a random point in a polytope. There is some work on that general problem, but I don't know if it would be practical for your special case. For example:
Rubin, Generating random points in a polytope, Communications in Statistics - Simulation and Computation, 13 (1984) 375-396.
Probably searching forward and backwards from that will uncover other relevant articles.