Random weighted choice
<p>I have data like that:</p>

<pre><code>d = (
  (701, 1, 0.2),
  (701, 2, 0.3),
  (701, 3, 0.5),
  (702, 1, 0.2),
  (702, 2, 0.3),
  (703, 3, 0.5)
)
</code></pre>

<p>Where (701, 1, 0.2) = (id1, id2, priority)
Is where pretty way to choice id2 if I know id1, using priority?</p>

<p>func(701) should return:<br>
&nbsp;&nbsp;1 - in 20% cases<br>
&nbsp;&nbsp;2 - 30%<br>
&nbsp;&nbsp;3 - 50%<br>
Percent will be rough of course</p>
