Questions about the design mode of the item drop probability table

Source: Internet
Author: User
Design model of the item drop probability table ~ Drop probability table id & nbsp; item id & nbsp; Adventure & nbsp; activity & nbsp; & nbsp; Copy & nbsp; design mode of Battle & item drop probability table
The younger brother posted the post for the first time ~
Drop probability table
Id item id adventure activity copy battle...
1 5 8 10 12 14
2 7 15 5 20 0
3 9 20 0 30 0

The probability that an item (item id) drops in an action (such as adventure or copy)

Can I create this table like this?
How to write PHP code?
For example, the probability that the item id5 is obtained when the copy is obtained

$ A = mt_rand (); // 8 + 10 + 12 + 14 = 44
If ($ ?) {// Random number greater than 18 and less than 30
// Here is the code for getting the item
}

Don't know? How to write, that is, how to get at 18 and 30
Share with PHP mysql:
------ Solution --------------------
I don't know why.

However, if I did it, I would definitely directly rand (0,100) and then verify if it is smaller than 12. 12 is 12%.

What does your code mean by adding up the probability of 100% in several ways? I don't understand why this setting exists.
------ Solution --------------------
Listen to the first floor, as long as the judgment is less than 12 is your copy probability
------ Solution --------------------
Is there another hidden condition for the landlord not to mention? : Can I drop at most one device at a time?
------ Solution --------------------
The sum of probabilities is 1 (100%). you need to clarify your requirements and then ask again.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.