title: Replacing objects in one array to another array, randomly. Swift 4
body: <p>Two arrays</p>
  
  <pre><code>let array1 = ["A","B","C","D","E","F","G"]
  
  let array2 = ["a","b","c","d","e","f","g"]
  </code></pre>
  
  <p>I want to choose an index from array2 and replace the object in array1 at the same index with the object from array2. For example</p>
  
  <pre><code>array1[3] = array2[3] //["A","B","C","d","E","F","G"]
  </code></pre>
  
  <p>I want to do this randomly, for example</p>
  
  <pre><code>let randomIndex: Int = Int(arc4random()) % (array2.count)
  </code></pre>
  
  <p>I want to do this in a 'for' loop until all the indices and objects for array2 are used, but I DON'T WANT TO REPEAT a randomIndex. </p>
  
  <p>If I decrement the number of objects after each iteration, I still could get the same random index. If I use a Set of indices, and remove the used index, I lose my 'orderedness' (if that's a word). </p>
  
  <p>So I seem to be stuck. BTW swift 4's .randomElement won't work on an array of Strings.</p>
  
  <p>Any thoughts?</p>
  
  <pre><code>for object in array2 {
  
    let randomIndex: Int = Int(arc4random()) % (array2.count)
    array1[randomIndex] = array2[randomIndex]
    array2.remove(at: randomIndex)
    }
  </code></pre>
  
  <p>The above does NOT work as I desire. When the object is removed, a new order is established, and I can't replace the object in array1 at the appropriate index.</p>
  
  <p>I'm missing something obvious, but I'm not seeing it. I'm using Swift 4.2.</p>