N
N
nezzard2017-02-16 02:14:51
Algorithms
nezzard, 2017-02-16 02:14:51

How to organize logic in a lottery with a percentage of success?

Good night, there is something like this problem, there are 5 players who make bets. The winning percentage for all is 60 percent. Those. 2 out of 5 lose.
Each of the players has some kind of win rate, for example, a player will have 1 percent of a possible victory a little more than others.
If you choose 2 random numbers, then the rand function can easily handle it, but if you need to choose 2 based on the win rate of others, then here I don't understand how to write it logically.
Please give some logic

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2017-02-16
@nezzard

For example:
1. We make a list of players, we indicate to them "luck modifiers"
2. We make a list of prizes, in descending order of value
3. We play a "game" for each player, generating a random number
3a. Apply a "luck modifier" to the result. You can also make it a multiplier.
4. Sort the players by the result of "games".
5. We write out the players in the table, assigning each a prize or nothing.
Example https://jsfiddle.net/obsu358h/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question