search

Home  >  Q&A  >  body text

mysql - php How to generate a prize based on the prize's winning probability value (0-10000)?

How to generate a prize based on the prize's winning probability value (0-10000) in php?
How to implement the algorithm? Among 10 prizes

PHP中文网PHP中文网2811 days ago492

reply all(1)I'll reply

  • 阿神

    阿神2017-05-16 13:01:16

    Every station understands what you mean, but the easier way to draw immediately is:

    1.从0到100随即生成一个整数
    2.设置中奖范围 比如10%的中奖率 那么1到10是中奖数字
    3.然后根据抽中后的数字判断是几等奖
    

    If you feel it is not safe, you can also increase the range, such as 0 to 10,000, and then set the winning range, etc.

    reply
    0
  • Cancelreply