title: Replace values in a 2D array with different random numbers
body: <p>I have a 2D array (image) in which I want to replace array values greater than some threshold with a random number in some range. My attempt was to use numpy.random.uniform, as so</p>
  
  <pre><code>Z[Z &gt; some_value] = uniform(lower_limit,upper_limit)
  </code></pre>
  
  <p>However I've found that this replaces all values above the threshold with the same random value.  I would like to replace all array values above the threshold with a different random value each. </p>
  
  <p>I think this would require some interation over the entire array for which I would need to generate a random value if the condition is met.  How would I do this?</p>