# Generate Constrained Vector of Random Numbers?

I'm having trouble creating a random vector $\vec{V}$ starting with a standard 0:1 randon number generator subject to the following set of constraints: (given parameters $D$, $L$, and $\theta$)

1. The vector $\vec{V}$ must be $N$ units long
2. The elements must have an average of $\theta$
3. No 2 successive elements may differ by more than +/-10 (i.e. $|V_i-V_{i+1}|\leq 10$)
4. $D = \sum_i(L*cos(V_i-\theta))$

I'm having the most problems with the last one. Any ideas?

Edit
New thought on the problem: I've noticed that constraints (2) and (4) can be simplified by setting $\theta$ to 0 and then once a valid vector for $\theta==0$ is found, add $\theta$ to all elements to bias the mean to the true $\theta$ again.

-
Do you want the result to have any particular distribution? –  joriki Apr 10 '13 at 5:07
Not picky, but it would be nice if the original random numbers used were a uniform distribution. Makes the coding easier later. –  CodeFusionMobile Apr 10 '13 at 5:19
To that end, I would even accept a trivial solution to the constraints that could be randomly perturbed in some way. –  CodeFusionMobile Apr 10 '13 at 5:22