title: Randomly spawning enemies XNA 4.0 (WP7)
body: <p>I am creating a 2d side scrolling(kinda) game for the windows phone in C# and XNA. </p>
  
  <p>I have a character animation that makes it look like the sprite is moving, however the background and enemies are the only things moving. 
  I have loaded the texture for the enemy and the position on the screen is static so that's fine.
  But my problem is, I want to spawn these enemies at random intervals.
  I have set up a random number generator, an int and a couple TimeSpan variables.</p>
  
  <p>Here is the code I have placed in the UpdateEnemies method. </p>
  
  <p><strong>Note</strong>: in Update, I am calling <code>UpdateEnemies(gameTime);</code></p>
  
  <pre><code>random = new Random();
  spawnSeconds = random.Next(1, 6);
  enemySpawnTime = TimeSpan.FromSeconds(spawnSeconds); 
  if (gameTime.TotalGameTime - previousSpawnTime &gt; enemySpawnTime)
  {
      previousSpawnTime = gameTime.TotalGameTime;
      // Add an Enemy
      AddEnemy();
  }
  </code></pre>
  
  <p>I am having an issue here as the enemies spawning is not random. They spawn at the same interval for that particular run.</p>
  
  <p>I have used Breakpoints and the <code>spawnSeconds</code> and <code>enemySpawnTime</code> update fine everytime but still this issue.</p>
  
  <p>Any help would be greatly appreciated.</p>