vendredi 29 mai 2015

Laravel 5 Random by Percentage

I'm doing a small random script with Laravel 5 where i want to get a random winner by percentage based on the number of entries he has, but i'm trying not to have like 200 entries with the same person... instead i'm trying to do something like this:

Table Entries:

ID - USER - ENTRIES

Ex: Entrie ID 1 - User ID 1337 - With 470 Entries

So That way he has 470 total entries but.. only one row in the database table.

My Question is.. how can i do it and if is it possible to do something with that 470 Entires to give the user some kind of advantage over users with less Entries..

Lets say there are 10 users, with total of 1000 Entires, User ID 1337 has 470 Entires, that means 47% of winning the prize..

Is there a way to do this kind of thing? cuz i just feel like having 1000 rows for just 10 users is not practical at all..

Thanks, TiagoF




Aucun commentaire:

Enregistrer un commentaire