随机数发生器将数字吸引到范围内的任何给定数字?

我试图想出一个随机数生成器,它返回一个介于0和1之间的浮点值,以一个方向或另一个方向对返回值进行加权。

是否有任何可靠的方法来传递两个数字,比如Random(0.5),其中’0.5’表示0到1之间的数字将被吸引到0.5。

这可能有帮助吗?

http://www.c-sharpcorner.com/UploadFile/trevormisfeldt/NormalDistribution08302005003434AM/NormalDistribution.aspx

它不能准确地解决你的问题,但我想知道建模钟形曲线是否可能提供你正在寻找的趋势。

虽然有趣的问题,我可以问你想要解决的问题吗?

第二次编辑:我刚刚注意到另一个可能有帮助的S / O问题:

基于正态分布的范围内的随机数

你所指的是投射到钟形曲线上的随机数

我通常做以下几点

///  /// generate a random number where the likelihood of a large number is greater than the likelihood of a small number ///  /// the random number generator used to spawn the number /// the random number public static double InverseBellCurve(Random rnd) { return 1 - BellCurve(rnd); } ///  /// generate a random number where the likelihood of a small number is greater than the likelihood of a Large number ///  /// the random number generator used to spawn the number /// the random number public static double BellCurve(Random rnd) { return Math.Pow(2 * rnd.NextDouble() - 1, 2); } ///  /// generate a random number where the likelihood of a mid range number is greater than the likelihood of a Large or small number ///  /// the random number generator used to spawn the number /// the random number public static double HorizontalBellCurve(Random rnd) { //This is not a real bell curve as using the cube of the value but approximates the result set return (Math.Pow(2 * rnd.NextDouble() - 1, 3)/2)+.5; } 

请注意,您可以调整公式以更改钟形的形状以调整结果的分布

例如,一个简单的Math.Sqrt(rnd.nextdouble())会将所有数字倾斜为1,而一个简单的Math.Power(rnd.nextdouble(),2)会将结果倾斜为0