物品掉落概率表的设计模式有关问题

WBOY
Release: 2016-06-13 12:40:36
Original
848 people have browsed it

物品掉落概率表的设计模式问题
小弟第一次发帖~
掉落概率表
id   物品id   冒险   活动   副本   对战   ...
1     5        8      10    12     14
2     7        15      5     20     0
3     9        20      0     30     0

意思是某物品(物品id) 在某行为(如冒险,副本)中掉落几率是多少

我想问下 这个表能这样建么
PHP代码怎么写呢
如 取打副本时获得物品id5的概率

<br />
$a=mt_rand(0,44);  //即8+10+12+14=44<br />
if($a<? && $a>?){  //随机数大于18小于30<br />
 //此处是得到物品的代码<br />
}<br />
Copy after login

不知道?处怎么写 也就是说18和30怎么取得

PHP mysql
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!