Board index » delphi » Wanted: RNG with bellcurve distro
Chuck S.
Delphi Developer 
Fri, 23 Dec 2005 21:40:25 GMT

Chuck S.
Delphi Developer 
Fri, 23 Dec 2005 21:40:25 GMT
Wanted: RNG with bellcurve distro
I'm looking for a random number generator which generates random numbers with a
bell curve distribution. For example, if I gave the RNG a range of 0100, the most numbers generated near 50. If I gave a range of 4 to +4, then most numbers would be generated near 0. Pascal preferred, but other languages ok.  
Joche
Delphi Developer 
Sat, 24 Dec 2005 02:24:52 GMT
Re:Wanted: RNG with bellcurve distroHi Chuck! QuoteChuck S. wrote: function myrandom(max: integer) : integer; for range 0..100 use myrandom(100); i'm really not sure, if this function will result in the distribution kind regards 
Warwen Onovud
Delphi Developer 
Sat, 24 Dec 2005 03:31:09 GMT
Re:Wanted: RNG with bellcurve distroQuote> I'm looking for a random number generator which generates random numbers a bunch of SWAGfiles from (for example) ftp://garbo.uwasa.fi/pc/turbopas and search for 'gauss'. Hope that will help 
Dr John Stockto
Delphi Developer 
Sat, 24 Dec 2005 03:43:05 GMT
Re:Wanted: RNG with bellcurve distroJRS: In article <bebt88$3blb...@ID185685.news.dfncis.de>, seen in news:comp.lang.pascal.misc, Chuck S. <ch...@gil.net> posted at Mon, 7 Jul 2003 13:40:25 : Quote>I'm looking for a random number generator which generates random numbers with a  
Bob Scho
Delphi Developer 
Sat, 24 Dec 2005 10:56:50 GMT
Re:Wanted: RNG with bellcurve distroOn Mon, 7 Jul 2003 20:43:05 +0100, Dr John Stockton Quote<s...@merlyn.demon.co.uk> wrote: page, above, and saw my version of Gauss discussed. Of course, there's also the simpleminded approximation from the "Mean tends to a Gaussian"  simply add up 12 uniformlydistributed random numbers, which will be approximately a Gaussian with a mean of 6 and a standard deviation of [here I forget the details, but it is fairly simple to derive]. I learned this one years ago from the IBM Scientific Subroutine Package, written in Fortran II (not IV!). Bob Schor 
Dr Engelbert Buxbau
Delphi Developer 
Mon, 26 Dec 2005 21:11:10 GMT
Re:Wanted: RNG with bellcurve distroQuoteChuck S. wrote: begin 
Jan Philip
Delphi Developer 
Mon, 26 Dec 2005 23:01:59 GMT
Re:Wanted: RNG with bellcurve distroOn 7 Jul 2003 13:40:25 GMT, "Chuck S." <ch...@gil.net> wrote: Quote>I'm looking for a random number generator which generates random numbers with a standard deviation you want. rNormal returns the result. rNormal2 returns two of them in less time than 2 calls to rNormal. function rNormal( const mean, sd : tFloat) : tFloat; { Returns a FP number that is normal with the given mean } { if execution time is a consideration, it can be modified var u1, u2, v1, v2, s : tFloat; begin {  rNormal  } repeat rNormal := mean + sd * sqrt( (2.0 * ln( s) / s)) * v2; end; {  r normal  } procedure rNormal2( const mean, sd : tFloat; { Returns reals X1 and X2 that are normally distributed with } var u1, u2, v1, v2, s, thing : tFloat; begin {  rNormal2  } repeat thing := sqrt( (2.0 * ln( s)) / s); end; {  r normal2  } 