title: How do I create a population sample that follows specified demographics?
body: <p>I have the following class:</p>
  
  <pre><code>class Person
  {
    GenderEnum Gender;
    RaceEnum Race;
    double Salary;
    ...
  }
  </code></pre>
  
  <p>I want to create 1000 instances of this class such that the collection of 1000 Persons follow these 5 demographic statistics:</p>
  
  <ol>
  <li><p>50% male; 50% female</p></li>
  <li><p>55% white; 20% black; 15% Hispanic; 5% Asian; 2% Native American; 3% Other;</p></li>
  <li><p>10% &lt; $10K; 15% $10K-$25K; 35% $25K-$50K; 20% $50K-$100K; 15% $100K-$200K; 5% over $200K</p></li>
  <li><p>Mean salary for females is 77% of mean salary for males</p></li>
  <li><p>Mean Salary as a percentage of mean white salary:
  white - 100%.
  black - 75%.
  Hispanic - 83%.
  Asian - 115%.
  Native American - 94%.
  Other - 100%.</p></li>
  </ol>
  
  <p>The categories above are exactly what I want but the percentages given are just examples.  The actual percentages will be inputs to my application and will be based on what district my application is looking at.</p>
  
  <p>How can I accomplish this?</p>
  
  <p><strong>What I've tried:</strong></p>
  
  <p>I can pretty easily create 1000 instances of my Person class and assign the Gender and race to match my demographics.  (For my project I'm assuming male/female ratio is independent of race).  I can also randomly create a list of salaries based on the specified percentage brackets.  Where I run into trouble is figuring out how to assign those salaries to my Person instances in such a way that the mean salaries across gender and mean salaries across race match the specified conditions.</p>