0

example: I have an array of numbers like [1.0231, 1.1233, 2.1322, 2.321] I want to have like 35% pick 2.1322 and 40% to pick 2.321 and the rest for the other numbers.

I want a system that choose randomly but more odds to pick a number the bigger it is.

  • Treat the numbers like weights and use rejection sampling? – Peter O. Jun 24 '22 at 01:43
  • 1
    Does this answer your question? [What would be the fastest algorithm to randomly select N items from a list based on weights distribution?](https://stackoverflow.com/questions/62455064/what-would-be-the-fastest-algorithm-to-randomly-select-n-items-from-a-list-based) – Peter O. Jun 24 '22 at 01:43
  • Also: https://stackoverflow.com/questions/5027757/data-structures-for-loaded-dice/63166311#63166311 – Peter O. Jun 24 '22 at 01:44

0 Answers0