title: Spawning Nodes randomly between positions
body: <p>I'm trying to make a matching game, where these circles appear randomly in a rectangular area, without overlapping. Here's the spawning function:</p>
  
  <pre><code>func SpawnRed(){
  
      var Red = SKSpriteNode(imageNamed: "Matched_Red")
      Red.size = CGSize(width: 50, height: 50)
      Red.zPosition = 1
  
      let MinValueX = self.size.width / 3 + 50
      let MaxValueX = self.size.width / 1.5 - 50
      let MinValueY = self.size.height / 1.5 + 25
      let MaxValueY = self.size.height / 6
      let SpawnPointX = UInt32(MaxValueX - MinValueX)
      let SpawnPointY = UInt32(MaxValueY - MinValueY)
  
      Red.position = CGPointMake(CGFloat(arc4random_uniform(SpawnPointX)) + MinValueY,CGFloat(arc4random_uniform(SpawnPointY)))
  
      self.addChild(Red)  
  }
  </code></pre>
  
  <p>But for some reason, I keep getting </p>
  
  <blockquote>
    <p>"Thread 1: EXC_BAD_INSTRUCTION(code=EXC_1386_INVOP,subcode=0x0)" error. </p>
  </blockquote>
  
  <p>Can you find the solution? Also, it'll be so helpful if you tell me how to spawn nodes without overlapping.</p>