W
W
WAYNEDEV2020-07-28 18:39:59
JavaScript
WAYNEDEV, 2020-07-28 18:39:59

Random number and probability of falling out?

There is data about the player:
Invested: 100 rubles
Withdrew: 200 rubles
We need to calculate how much he took as a percentage, depending on his replenishment. We consider: ((Invested - Withdrawn) / Invested) * 100 = -100%, where the minus is the damage to the game, because he gave from his money. If there is a plus, then this is in the profit game

. So, we have -100%, from there we need to make a random number, which will gradually roll it back to 0%, giving win and lose, but with less probability. The smaller the number is 0, the less likely it is to win.

In general, the essence:
1) If the percentage is greater than 0%, then it will be a pure random
2) If the percentage is less than 0%, then, depending on this value, give a random in favor of the game, and not the player. At -100%, the game itself will win, the player will no longer be able to
3) As a result, you need to get the value true or false

What can you think of for this task? I googled all over and didn't find anything.
Help me please!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Sokolov, 2020-07-28
@WAYNEDEV

Take a random (fractional) number from 0 to 100, including 0, excluding 100.
Threshold - a value above which we will consider a win, below a loss of the player.
The percentage is higher 0- pure random. Threshold = 50.
Percent –100- no chance. Threshold = 100.
Between percentage 0and –100, the threshold changes linearly from 50 to 100.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question