title: random numpy array whose values are between -1 and 1 and sum to 1
body: <p>what is the best way to create a NumPy array <code>x</code> of a given <code>size</code> with values randomly (and uniformly?) spread between <code>-1</code> and <code>1</code>, and that also sum to <code>1</code> ?</p>
  <p>I tried <code>2*np.random.rand(size)-1</code> and <code>np.random.uniform(-1,1,size)</code> based on the discussion <a href="https://stackoverflow.com/questions/55769367/numpy-random-array-values-between-1-and-1">here</a>, but if I take a transformation approach, by re-scaling both methods by their sum afterwards, <code>x/=np.sum(x)</code>, this ensures the elements sum to 1, but: there are elements in the array that are suddenly much greater or less than 1 (&gt;<code>1</code>, &lt;<code>-1</code>) which is not wanted.</p>