我想从3-10或4-6等范围中选择一个随机数.应该选择数字,使得数字越低,选择的机会就越多.我下面的代码只选择具有相同概率的每个数字.
private int bonusPoints;
private double randomBonusPoints = Math.Random() * 100;
bonusPoints = (int)randomBonusPoints;
Run Code Online (Sandbox Code Playgroud)
如何从分布中选择P(3,4,5)=85%, P(6,7,8)=10%, P(9,10)=5%?