求以下概率如何实现???
a 中奖率为 1/1000
b 中奖率为 25/1000
c 中奖率为 100/1000
d 中奖率为 500/1000
e 中奖率为 800/1000

解决方案 »

  1.   

    Random(1000) < 1
    Random(1000) < 25
    Random(1000) < 100
    Random(1000) < 500
    Random(1000) < 800
      

  2.   

    强烈鄙视问题解决后不结贴的人!
    强烈鄙视技术问题解决后把贴子转移到非技术区的人!
    鄙视你们!http://community.csdn.net/Expert/topic/5216/5216675.xml?temp=.9262659
      

  3.   

    原来如此:)
    ============================================================
    An ounce of luck is better than a pound of wisdom.
    聪明才智,不如运气。
    ============================================================