title: rand% spawning all my entities in predictable pattern
body: <p>I have been trying to create a "1D shooter game" with prints in c++. My problem is I am trying to spawn enemies from a list at random moments and I also want to make it random where the enemy spawns (left or right of the screen).</p>
  
  <p>This does not seem to fully work, as I seem to get a stream of contiguous enemies from one side, and only after all those enemies coming from the left side are killed, enemies from the right might appear. </p>
  
  <p>I never seem to get a couple coming from the left and a couple coming from the right at similar times. Its always either one or the other.
  In addition to this, once an enemy is spawned, the rest seem to spawn almost all at once, and suddenly there is no spawning whatsoever. The pattern seems predictable and wrong. </p>
  
  <p>Here is my method that is called every time in the game loop (the game loop takes care of calling srand(time(NULL)) on every iteration, and after that calls this function.</p>
  
  <pre><code>void Enemy::spawnEnemy()
  {
      if (enemList.size() &lt; 5)
      {
          if (!(rand() % 3))
          {
              if (!(rand() % 2))
              {
                  Enemy * newEnemy = new Enemy(worldWidth, 'l');
                  enemList.push_front(newEnemy);
              }
              else
              {
                  Enemy * newEnemy = new Enemy(0, 'r');
                  enemList.push_front(newEnemy);
              }
          }
      }
  }
  </code></pre>
  
  <p>Thank you very much in advance. I really hope someone can solve this problem, because I have been struggling to find an answer for it!</p>