Generate random numbers whose sum is equal to a constant value modulo n I want to generate $n$ random numbers $u_i \in [ 0, 2^{\kappa + 1})$ such that $\sum u_i = c$ $mod$ $2^{\kappa + 1} $, where c is a constant.
Also, taking $n - 1$ random numbers and subtracting their sum from $b \cdotp 2^{\kappa + 1} + c$, where $b \cdotp 2^{\kappa + 1}$ is the closest multiple of $\;2^{\kappa + 1}$ that is greater than sum of the $n - 1$ random numbers, to get the $n^{th}$ random number a good solution?  

P.S. I want to know if there's a solution to this problem that'll ensure good statistical properties.
For $i=1, \dots, n-1$, generate $n-1$ random numbers $u_i \in [0,2^{κ+1})$ and define $u_n = \left(c - \sum_{i=1}^{n-1} u_i\right) \bmod 2^{κ+1}$.