How to get random value from array set an value in array that will be one to selected more than other?
array('00','01','02');
I want to select an random value from this array with most selected value be ’00’, i.e the ’00’ value will be selected 80% and other two values will be 20%.
Here array can have many values, its only an example with three values
I think the code is self explanatory…
Array will have many elements case will come when lets say the requirement will come like 3% probability of “00” 28% prob. of “01” rest to other elements…In that case use array_fill function to fill elements in masses…and array_merge them
Like for the same case I’ve taken answer will be