title: Random choice with negative weights
body: <p>In my python program, I have three variables <code>a</code>, <code>b</code> and <code>c</code>. They are all floats, and may be positive or negative with no upper and lower bounds.</p>
  
  <p>How would I go about devising a function that takes these variables as weights and randomly chooses a corresponding action (<code>A</code>, <code>B</code> &amp; <code>C</code>)?</p>
  
  <p><strong>Example</strong>:</p>
  
  <pre><code>a = 10
  b = -2
  c = 7
  </code></pre>
  
  <p>The function should perform <code>A</code> most of the time, <code>C</code> some times, and <code>B</code> the least often.</p>
  
  <p>The 'weighted random functions' I found on this site do not deal with negative weights.</p>