title: Changing a value in NumPy array to parameter and not to specific value
body: <p>Apparantly there is something that is very weird in the assignment to NumPy arrays.</p>
  
  <p>Here's my very simple code:</p>
  
  <pre><code>def my_function(r1, r2, N):
      r = np.random.randint(2, size=N)
      ind = np.where(r == 0)
      ind = ind[0]
      print(len(ind))
      print(r[ind])
      np.put(r, ind, r1)
      print(r[ind])
  </code></pre>
  
  <p>I then run in PyCharm console:
  my_function(0.9, 1.1, 10)</p>
  
  <p>Output:</p>
  
  <pre><code>7
  [0 0 0 0 0 0 0]
  [0 0 0 0 0 0 0]
  </code></pre>
  
  <p>Question - why wasn't the values changed to 0.9?</p>
  
  <p>If instead of r1 I would explicitly put 0.9 that would have worked. But somehow the reference doesn't work. Tried many options of bypassing. None worked. Help!</p>
  
  <p>Thanks </p>