Hallo!

I would like to generate random triads of numbers (h, v, d).

The d number is generated according to the generated values of h, v following some if statements

h and v are integers within a known interval

For example if h=1 and v=2 ... d can take the value 1 (with possibility 83.3%) or 2 (6.7 %) or 3 (10 % possibility).

How can I declare these possibilities in Python???

I would like to generate random triads of numbers (h, v, d).

The d number is generated according to the generated values of h, v following some if statements

h and v are integers within a known interval

For example if h=1 and v=2 ... d can take the value 1 (with possibility 83.3%) or 2 (6.7 %) or 3 (10 % possibility).

How can I declare these possibilities in Python???

Thank's a lot...

random.random() gives you a uniform distribution between zero and one. So you can split it up. I don't understand your h,v,d description, but something like this can get your the distribution you want:

A code example could be more effective.

However, the probability of d=d1 is 0.3, the probability of d=d1_2 is 0.5 and the probability of d=d1_3 is 0.2. Is there any function to insert these probabilities in the above code?

Thank you very much!