How to control probability? What is the idea? I think so. a turntable is divided into four parts, but how can we control them with different probabilities? How to write? I can't think of it anymore ..... Guidance ~ Probability $ lottery_arrarray (0 & gt; array (id & gt; 1, min & gt; 0, max & gt; 90, chance & gt; 10 ), 1 & gt; array (how do I control the probability of id? What is the idea?
I think so. a turntable is divided into four parts, but how can we control them with different probabilities? How to write?
I can't think of it anymore ..... Guidance ~ Chance is probability
$ Lottery_arr = array (
"0" => array ("id" => 1, "min" => 0, "max" => 90, "chance" => 10 ),
"1" => array ("id" => 2, "min" => 90, "max" => 180, "chance" => 20 ),
"2" => array ("id" => 3, "min" => 180, "max" => 270, "chance" => 30 ),
"3" => array ("id" => 4, "min" => 270, "max" => 360, "chance" => 40 ),
)
Share: More
------ Solution --------------------
Http://denghai260.blog.163.com/blog/static/7268640920128244332285/
This can meet your requirements