current location:Home>download site>Library download>Other libraries>PHP function class for winning probability algorithm
PHP function class for winning probability algorithm
Classify:Library download/Other libraries | Release time: 2018-01-20 | visits: 15092 |
Download: 396 |
Latest Downloads
Fantasy Aquarium
Girls Frontline
Wings of Stars
Little Flower Fairy Fairy Paradise
Restaurant Cute Story
Shanhe Travel Exploration
Love and Producer
The most powerful brain 3
Odd Dust: Damila
Young Journey to the West 2
24 HoursReading Leaderboard
- 1Andrew Tate Announces Plans to Invest $1 Million in $DADDY Coin Once He Reaches 10 Million Followers
- 2Liskov Substitution Principle
- 3Interface Segregation Principle
- 4What's moving Sensex and Nifty
- 5Cristiano Ronaldo Launches New NFT Collection Amidst a Judicial Crisis
- 6Mastering Overflow Scroll Gradient with CSS
- 7Adept Unveils Advanced AI Agents with Multimodal Capabilities
- 8FTX's Proposed Reorganization Plan Faces Legal Challenges Despite Creditor Support
- 9Pseudonymous Analyst Bluntz Predicts Huge Upside Move Is Coming for Ethereum (ETH)-Based Memecoin Pepe (PEPE)
- 10Dormant Bitcoin Wallet From the Satoshi Era Suddenly Comes to Life
- 11Advanced SCSS: Function and Mixins
- 12XRP Can Double to $1 by 2025, but Don't Expect It to Skyrocket from There
- 13Cardano (ADA) Price Ready to Drop ‘Bombshell’ as Secret Catalyst Emerges
- 14Single Responsibility Principle
- 15Doge2014: A New Token to Honor and Celebrate 10 Years of Dogecoin
Latest Tutorials
-
- Go language practical GraphQL
- 1336 2024-04-19
-
- 550W fan master learns JavaScript from scratch step by step
- 2733 2024-04-18
-
- Getting Started with MySQL (Teacher mosh)
- 1250 2024-04-07
-
- Mock.js | Axios.js | Json | Ajax--Ten days of quality class
- 2105 2024-03-29
$proCur) { $randNum = mt_rand(1, $proSum); if ($randNum <= $proCur) { $result = $key; break; } else { $proSum -= $proCur; } } unset ($proArr); return $result; }
The prize array is a two-dimensional array that records all the prize information of this lottery, where id represents the winning level, prize represents the prize, and v represents the probability of winning. Note that v must be an integer. You can set v of the corresponding award to 0, which means that the probability of winning the award is 0. The sum of v in the array (base). The larger the base, the more accurate the probability can be reflected. . In this example, the sum of v is 100, then the probability of winning for the tablet is 1%. If the sum of v is 10,000, the probability of winning is one in ten thousand. $proArr is a preset array. Assume that the array is: array(100,200,300,400). It starts by screening the first number from the probability range of 1,1000 to see if it is within its occurrence probability range. If not, it will The probability space is the probability space of the value of k minus the number just now. In this case, it is minus 100, which means that the second number is filtered within the range of 1,900. In this way, until the end of the screening, there will always be a number that meets the requirements. It's like touching something in a box. If the first one isn't there, the second one isn't there, and the third one isn't there, then the last one must be. This algorithm is simple and very efficient. The key is that this algorithm has been applied in our previous projects, especially in projects with large amounts of data. The efficiency is very good.