Biased Random Number Generator

前端 未结 10 465
春和景丽
春和景丽 2020-12-09 12:41

I am looking for a random number generator that can be biased. For instance, say I want a random number between 1-5, with the probability being:

1: Comes up 20% of t

10条回答
  •  Happy的楠姐
    2020-12-09 13:47

    I am doing to do the same thing and I found this: http://eli.thegreenplace.net/2010/01/22/weighted-random-generation-in-python/

    Seems good enough for the purpose you stated.

提交回复
热议问题