# Uniform random number generation

Given a uniform random number generator that generates integers between any given range, a n-tuple $b$, and an integer $c$, how can one uniformly generate n-tuples ($x$) that meet the following constraints:

$$1 \le x_i \le b_i$$ $$\sum x_i \le c$$

where $b_i > 1$ for all $i$, and where $c \ge \max(b_i) + (n-1)$?

All numbers here are positive integers.

By uniformly generate, I mean that every valid n-tuple that meets the above constraints has an equal probability of being generated.

One can generate $n$ random $x_i$ with uniform distribution on $\{1, \ldots, b_i\}$, and then discard the result if $\sum_i x_i \leq c$.