Lottery backstage management

now I am doing an app raffle function, as well as a background page on the computer side, which can be used to configure the prize and probability information of the app raffle. For example, there is a lucky draw rule, which requires 8 commodities, and the probability of 8 commodities is 100%. My practice is to judge whether the probability of the sum of 8 items is 100% when adding the 8th item, and the error will be prompted if it is not 100%. In doing so, there is a problem: after adding 8 items, I now want to change the lieutenant general probability of the commodity, because the sum of the probability will be 100 when the commodity is 8, which makes me unable to change the winning probability now. How to solve this problem? Ask for advice

Oct.13,2021

I think I have to change the design.

if I were to do it, I would design a weight for each prize, that is, the so-called probability, which may be an integer p ,
abc three prizes correspond to three values pa,pb,pc , and the probability of winning an is pa/ (pa+pb+pc)

.

in this way, no matter how many prizes are awarded, they are randomly assigned to the sum of the p values of all the lottery products.
increase the p of one prize, and the other p will reduce the probability even if it does not change. The front end can write an algorithm by the way to dynamically show the current probability to the operator. It is not necessary to keep the sum at 100.


what do you mean by the eighth you change the probability of winning the lottery again? The 8 items before the change?
and the probability of winning the lottery is set, so go with a random number. If you need to change, just assign a certain identification point to each data.
how do you calculate the 100% probability of this piece of data? Random number?
Menu