RobertKipling Posted October 24, 2007 Share Posted October 24, 2007 To generate numbers on a bell curve, call this function with the mean and the standard deviation of the desired output. (This code was found elsewhere and adapted for AutoIt - use it if you find an application!) Func randNorm($mean, $stddev) $x1=0 $x2=0 $w=2 $y1=0 $y2=0 While ($w >= 1.0) $x1 = 2.0 * Random() - 1.0 $x2 = 2.0 * Random() - 1.0 $w = $x1 * $x1 + $x2 * $x2 WEnd $w = Sqrt((-2.0 * Log($w)) / $w) $y1 = $x1 * $w $y2 = $x2 * $w Return $y1 * $stddev + $mean EndFunc Link to comment Share on other sites More sharing options...
jvanegmond Posted October 24, 2007 Share Posted October 24, 2007 Bell Curve? I'm curious. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now