python function returns value based on probability
伊谢尔伦
伊谢尔伦 2017-05-24 11:34:47
0
1
731

You need to get a value, which is obtained from a function. There are two values ​​​​a and b in the function. It is required that the probability of returning a is 65%, and the probability of returning b is 35%. I would like to ask, how to implement it?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(1)
漂亮男人
if random(0,1) < 0.65
    return a
else
    return b
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template