I would like to return an array which has a set of unique elements randomly distributed according to custom frequency. My real world use-case is the repetition of carousel i
There is a very simple solution. The random() method returns a number between 0 and 1 inclusive.
Eg if the number returned is > 0.2, then output C (ie 80% chance).