Get random element in list, where the first elements have higher chance to be chosen than the last elements

后端 未结 0 1795
小蘑菇
小蘑菇 2020-12-07 20:53

Imagine a list of ordered by descending elements:

List list = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1];

How can I implement Random, so that t

相关标签:
回答
  • 消灭零回复
提交回复
热议问题