Let $x \lt y$. The usual pseudo-random number generators produce a number between $0$ and $1$. **Multiply** the result by $y-x$, and then **add** $x$.
This also works fine if $y \lt x$.
Let $x \lt y$. The usual pseudo-random number generators produce a number between $0$ and $1$. **Multiply** the result by $y-x$, and then **add** $x$.
This also works fine if $y \lt x$.