Generate random numbers with known discrete probabilities in Python
<p>I would like to generate random triads of numbers (h, v, d).</p>

<p>The d number is generated according to the random values of h, v following some if statements</p>

<p>h and v are integers within a known interval</p>

<p>Below there is a code example:</p>

<pre><code>l="low"
m="medium"
h="high"

for i in range (100):
   h=random.random()*3
   v=random.choice(['low', 'medium', 'high'])

   d1=1
   d1_2=random.randint(1,2)
   d1_3=random.randint(1,3)

   if 0&lt;h&lt;0.5 or h==0:
       if v==l:
           d=d1

       elif v==m:
           d=d1_2

       elif v==h:
           d=d1_3
</code></pre>

<p>The probability of d1 is 83.3%, the probability of d1_2 is 6.7% whereas of d1_3 is 10% </p>

<p>How can I insert these possibilities in Python???</p>

<p>Thank you very much in advance...</p>
