Draw system

0

I'm intending to make a sweepstakes system on my site. I read some questions (including one that I really liked what was this one ) and I noticed people saying that X Cities could never be raffled, while Y Towns raffled several times.

The question is: what is the reliability of the following draw cases?

Draw by SQL

SELECT 'id' FROM 'tabela' ORDER BY RAND () LIMIT 1;

PHP draw

<php
$minimo = 0;
$maximo = 10000;
$sorteio = rand($minimo, $maximo);
echo $sorteio;
?>

I thought of some formulas to include the weight in my lottery, but I realized that it would be easier just to register the same lottery item one more time.

In fact, the final question is: how to draw a lot of people, attributing to some of these advantages Example: John has 60% chance of being chosen, Maria has 40% chance) - It is better by the name of joão 6 times in the draw and by the name of Maria 4 times or there is some solution defined?

    
asked by anonymous 20.05.2017 / 18:59

1 answer

1

We have to understand a bit of statistics to get the final question.

An experiment is considered random when its occurrences may present different results. An example of this happens when throwing a coin that has different faces, being one face and another crown. The result of this release is unpredictable, as there is no way to know which side will look up.

The sample space (S) determines the possible possibilities of results. In the case of the throwing of a coin the set of the sample space is given by: S = {face, crown}, because they are the only two possible answers for this random experiment.

In probability, the occurrence of a fact or situation is called an event. Therefore, when casting a coin we are establishing the event. We then have that any subset of the sample space must be considered an event. An example can happen when we throw a coin three times, we get as a result of the event the following set:

E = {Face, Crown, Face}

The probability ratio is given by the possibilities of an event occurring taking into consideration its sample space. This ratio that is a fraction is equal to the number of elements of the event (numerator) on the number of elements of the sample space (denominator). Consider the following elements:

E é um evento.
n(E) é o número de elementos do evento.
S é espaço amostral.
n(S) é a quantidade de elementos do espaço amostral.
A Razão de probabilidade é dada por:

         n(E)
  P(E)= -----     sendo n(S) ≠ 0
         n(S)

Regarding your question we would have:

 S = {João, João, João, João, João, João, Maria, Maria, Maria, Maria}
 S =10

In the case of John

 E = {João, João, João, João, João, João}
 E = 6

 P(João) = 6/10 = 60%

And in the case of Maria

 E = {Maria, Maria, Maria, Maria}
 E=4

 P(Maria) = 4/10 = 40%

The probability is usually represented by a fraction, whose value will always be between 0 and 1.

We can also represent the probability with a decimal or percentage number

So John will have 60% probability against 40% of Mary in a number of elements equal to 10.

If this number of elements is 1000, for example, 6 of John and 4 of Mary would have:

P (John) = 6/1000 = 0.6%

P (Maria) = 4/1000 = 0.4%

    
20.05.2017 / 19:40