Hi, I'd like to pick a value from an array which is sorted using a priority value, 0-100.
However, I'm looking for a way that returns a value in the array with a higher priority more frequently.
Say my array has 5 values:
[100, 50, 10, 3, 1]
I would like the value "100" to be returned more often than "50". The value of "1" should rarely be chosen.
Two ways I think I can solve it, but not exactly ideal or efficient:
1. Put more of the higher priority values in the array: [100, 100, 100, 100, 100, 50, 50, 50, 50, 10, 10, 10, 3, 3, 1]
2. Multiply a random number (t) by a curve: http://easings.net/#easeInQuint and use that as the index (x).
Just wondering if there's a better way?
Thanks