I need to generate two positive numbers $a$ and $b$ both $\ge 1$, whose product is bounded $[2..z]$ and both have a limited coverage between 1 and respectively $a.max$ and $b.max$.
The draws should produce and uniform distribution for both numbers.
I need to generate two positive numbers $a$ and $b$ both $\ge 1$, whose product is bounded $[2..z]$ and both have a limited coverage between 1 and respectively $a.max$ and $b.max$.
The draws should produce and uniform distribution for both numbers.
It is not totally clear to me from the question, but it seems $A$ and $B$ must be uniform over $[1, a_{\max}]$ and $[1, b_{\max}]$ respectively
then one approach might be to
generate $A \sim \mathcal U[1, a_{\max}]$
set $B = \dfrac{a_{\max}b_{\max} -1 - (b_{\max} -1)A}{a_{\max}-1}$ which will have $B \sim \mathcal U[1, b_{\max}]$ as required
The product $AB$ will then be in $\left[\min(a_{\max},b_{\max}), \dfrac{(a_{\max}b_{\max} -1)^2}{4(a_{\max} -1)(b_{\max} -1)} \right]$ and you can check whether it is indeed a subset of $[2,z]$: