mardi 11 décembre 2018

Random formula for choice winner

i have site with promos and users, users can reg in promo, then 1 random user can win in this promo.

Now simple formula for choice winner:

$total_users = 100; //total users in promo
$winner_number = rand(1,$total_users);

But now user can invite anyone with unique link to promo and clicks on his link increase his invite counter for this promo:

$users[] = ['user_id'=>8,'invites'=>5];
$users[] = ['user_id'=>17,'invites'=>150];
$users[] = ['user_id'=>69,'invites'=>30];
$users[] = ['user_id'=>32,'invites'=>0];
... //array with users in promo

And need new formula to choice winner depends of invites (more invites - more chance to win), but without linear progression to win chance(avoid cheating)

Help me pls, i'm a newbie.




Aucun commentaire:

Enregistrer un commentaire