i have the following array:
public $percentage = array(
0 => 20.30,
1=> 19.96,
2=> 14.15,
3=> 45.59
);
// it sums in 100%
I need a random function to return the key by the percentage of the value,
for example: the possibility to get 0 is 20.30% and the possibility to get 2 is 14.15%, the first user got 0, the second one got 2.
Please let me know what is the function you suggest me to use.