N
N
newyork2016-01-12 01:35:38
Algorithms
newyork, 2016-01-12 01:35:38

What lottery winner selection algorithm to use?

given there is a lottery
each participant receives n number of lottery tickets from 100 pieces
, the more donations, the more tickets.
how to choose the best winner in this case?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
riot26, 2016-01-12
@riot26

just choose a random ticket from all, no?

K
kstyle, 2016-01-12
@kstyle

to assign to each participant a number equal to ti = ni/(n1+n2+...+nk) ni - the number of tickets of the i-th participant. k is the number of participants. choose a random number from 0 to 1 - let it be p. then we divide the segment [0,1] into intervals [ti-1,ti). Whatever p hit, that participant won. Next, randomly select a ticket from his tickets

V
Vasily, 2016-01-12
@Foolleren

take a very large number obtained by hardware (32 times tossed a coin - tails 0 heads 1 - translate in the calculator from binary to a more understandable calculus)
look for the remainder of dividing by the number of tickets +1 and get the number of the winning ticket
if your tickets are not numbered, then number them - make a list of participants, multiply the participant's serial number by the number of tickets and add them to the accumulator if the number in the accumulator is less than the number of the winning ticket, then the participant did not win and so on until the first winner

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question