title: How to spawn enemies in a mixed pattern based off ratios
body: <p>Let's say you have four enemy types: <strong>Basic, Strong, Poison, and Flying</strong>. For each level in the game, they each have their own spawning frequencies, which results in ratios of: <strong>0.4, 0.3, 0.2, and 0.1</strong> respectively.</p>
  
  <p>Is there a way to infinitely spawn these different enemy types in a way that they appear in a perfect pattern where the different types of enemy appear in an order as evenly mixed as possible? (Like skittles.)</p>
  
  <p>Example ratios of the above enemy types would be: <strong>BBBB, SSS, PP, F</strong>. So turned into a pattern could maybe look like: <strong>BSBPSFBSPB</strong> (Although I'm not even sure how I came to that result, it's mostly by guesstimation of how it may look.)</p>
  
  <p>I could manually code the spawning pattern for each level in the game, but there will be hundreds of levels. Setting their appearance frequency is easier but I don't know how to code that into a mixed pattern.</p>
  
  <p>Can anyone help?</p>