Xref: utzoo comp.sources.wanted:14308 comp.lang.c:34408 Newsgroups: comp.sources.wanted,comp.lang.c Path: utzoo!utgpu!cunews!wilf From: wilf@sce.carleton.ca (Wilf Leblanc) Subject: Re: Normal distribution random number generator -- WANTED Message-ID: Keywords: random number generator Sender: news@ccs.carleton.ca (news) Organization: Carleton University, Ottawa, Canada References: <1015@qusung.queensu.CA> Date: 1 Dec 90 04:46:33 GMT winarko@qucis.queensu.CA (Edi Winarko) writes: >I am looking for C source code to generate normal distribution >random numbers. I want to be able to generate random numbers >in the range of 0 - N (N could be equal to 9999, 99999 or 999999) that >have normal distribution with mean, say, u and standard deviation s. Add M random uniform random numbers x (where x is between 0 and N/M). Using M = 12 to 30, will generate random variables which are very close to normal, (not quite, but your specification of limits ensures the results will not 'truly' be normal). This works because of the central limit theorem (see any probability text). The variance and mean are easily computable from M and N. I hope this helps. If you want source code, mail me. >Thanks for any help, >--Edi W >winarko@qucis.queensu.ca -- --- Wilf LeBlanc Systems and Computer Eng. Internet: wilf@sce.carleton.ca Carleton University UUCP: ...!uunet!mitel!sce!wilf Ottawa, Ont, Canada