How to calculate the house-edge from a relational reward system?(similar with slot machine)

I want to know how can i calculate the house-edge from a game where we sort random numbers, each number have a probability and reward,

exemple:

Number 1 - Reward 20 - Probability 10%
Number 2 - Reward 30 - Probability 20%
Number 3 - Reward 5 - Probability 50%
Number 4 - Reward 40 Probabilty 20%...

So imagine that to play this game you pay 10, how can i calculate the house edge in this situation?

Always 1-4 value will return from this game, for example.

Thank you!

• Where can I play this game? – Qudit Sep 25 '17 at 1:01
• It was just an example, it is like a slot machine, but in programming language is something like this... – Victor Bini Sep 25 '17 at 1:02
• Yup. I was making a joke. – Qudit Sep 25 '17 at 3:07

Just add up the expected winnings. $1$ contributes an expected value of \$20 \cdot 10\%=2. Add up all the possible ways of winning and compare to the wager. If the total is less, the difference between the wager and the total expected winning is the house edge. With your data the house is losing badly.