The design mode problem of item drop probability table

Source: Internet
Author: User
Tags php mysql
PHP MySQL

The first time my younger brother post ~
Drop probability table
ID Item ID Adventure active Copy pvp ...
1 5 8 10 12 14
2 7 15 5 20 0
3 9 20 0 30 0

What is the probability that an item (item ID) is dropped in an action (such as an adventure, a copy)?

I was wondering if this watch could be built like this.
How do you write PHP code?
The probability of obtaining an item ID5 if a copy is taken
$a =mt_rand (0,44);  That is 8+10+12+14=44if ($a
 
   ?) {  //random number greater than 18 less than 30//here is the code to get the item}

I don't know how to write, which means 18 and 30 how to get it.


Reply to discussion (solution)

I don't know why I wrote this.

But if I do, it's definitely straight rand (0,100) and then verify that it is less than 12. 12 is 12.

What do you mean by this code is that the probability of adding up in several ways is 100%? I don't understand why this is set.

Well, I mean, the probability of a copy being a item is 10%.

Well, I mean, the probability of a copy getting a item is 10% b item is 15% c item when 20%
That's when you think of a copy. Rand (0,45%) value greater than 10% is less than 35%
So what do these 10 and 35 get?

Listen to the 1 floor, as long as the judge less than 12 is the probability of your copy

Landlord is not a hidden condition did not say?: A maximum of one piece of equipment at a time?

Oh, the example of the hair is I wrote the wrong sorry
The problem is, I'm going to drop a couple of things, which look like a table.
Less than 12% is something like that other (or more) how to write it?
Have to write >12 && < "some number" bar
Just don't know how to write it.

Everyone read the question I said on the third floor--
0 Floor I wrote the wrong thing, I wrote it wrong.

The probability of the sum of 1 (100%), you first think clearly the need to ask

  • 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.