title: Generate a specific amount of random numbers that add up to a defined value
body: <p>I would like to unit test the time writing software used at my company. In order to do this I would like to create sets of random numbers that add up to a defined value. </p>
  
  <p>I want to be able to control the parameters:</p>
  
  <ul>
  <li>Min and max value of the generated number</li>
  <li>The n of the generated numbers</li>
  <li>The sum of the generated numbers</li>
  </ul>
  
  <p>For example, in 250 days a person worked 2000 hours. The 2000 hours have to randomly distributed over the 250 days. The maximum time time spend per day is 9 hours and the minimum amount is .25</p>
  
  <p>I worked my way trough <a href="https://stackoverflow.com/questions/11003967/generate-3-random-number-that-sum-to-1-in-r">this</a> SO question and found the method</p>
  
  <pre><code>diff(c(0, sort(runif(249)), 2000))
  </code></pre>
  
  <p>This results in 1 big number a 249 small numbers. That's why I would to be able to set min and max for the generated number. But I don't know where to start.</p>