Random value from enum with probability

前端 未结 7 975
既然无缘
既然无缘 2020-12-20 21:40

I have an enum that I would like to randomly select a value from, but not truly random. I would like some of the values to be less likely of being selected so far. Here is

7条回答
  •  情歌与酒
    2020-12-20 21:56

    Here's a generic approach to choosing an enum value at random. You can adjust the probabilities as suggested here.

提交回复
热议问题