I would like to make a roulette for my PHP site, so I need to set the probability of the items. So I created an array with the probability of the different items:
(the higher the number the higher the chance)
$porpList = [
0 => [
"prop" => 10000,
"css" => "gray"
],
1 => [
"prop" => 1000,
"css" => "green"
],
2 => [
"prop" => 100,
"css" => "blue"
],
3 => [
"prop" => 10,
"css" => "violet"
],
4 => [
"prop" => 1,
"css" => "yellow"
],
5 => [
"prop" => 0.1,
"css" => "orange"
]];
Now comes the difficult part: The User with a higher Level should have a greater chance to get better Items and a lower chance to get trash Items, so with level 1 the probability would be:
10000
1000
100
10
1
0.1
And with Level 50 the probability should be something like this:
1
1
10000
1000
100
10
Logically, I could create a table in which all the possibilities for each level are listed, but I would like to solve this with a formula or similar.
Does anyone know a way to do this?