I've done some research and uncovered an algorithm designed for small lists in general. Here are a few arrays that I have:
arr = [1,2,3,4 .... , 96,97,98,99,100];
arr2 = [105, 110, 165, 170];
arr3 = [1,2,7,8,9];
My goal is to pass these arrays to a function and retrieve random numbers from them, but with a skewed probability towards higher numbers.
For instance, in array 1, the likelihood of selecting 96 should be greater than that of 4, and the likelihood of picking 97 should be higher than 96.
To explore options on how to generate a weighted distribution of elements randomly, check out this resource.
The typical solutions presented in such discussions may lead to performance issues when applied to my arrays.
How can I overcome this challenge?