Write a function that generates one of 3 numbers according to given probabilities | GeeksforGeeks You...

Please Visit: http://ift.tt/1ajReyV



Write a function that generates one of 3 numbers according to given probabilities | GeeksforGeeks

You are given a function rand(a, b) which generates equiprobable random numbers between [a, b] inclusive. Generate 3 numbers x, y, z with probability P(x), P(y), P(z) such that P(x) + P(y) + P(z) = 1 using the given rand(a,b) function.

The idea is to utilize the equiprobable feature of the rand(a,b) provided. Let the given probabilities be in percentage form, for example P(x)=40%, P(y)=25%, P(z)=35%..

http://ift.tt/1n4fdLL

http://ift.tt/1ikMFis



Write a function that generates one of 3 numbers according to given probabilities | GeeksforGeeks







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1ikMGTk

via LifeLong Community

No comments:

Post a Comment