Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!uhccux!munnari.oz.au!comp.vuw.ac.nz!windy!srwmrbd From: SRWMRBD@windy.dsir.govt.nz (ROBERT) Newsgroups: comp.lang.c++ Subject: random number package Message-ID: <649@windy.dsir.govt.nz> Date: 31 Aug 89 22:22:10 GMT Organization: DSIR Wellington, NZ Lines: 48 Random Number Package I have put together a C++ package for generating streams of univariate random numbers from a wide variety of distributions. It is particularly appropriate for the situation where one requires sequences of identically distributed random numbers. The set up time for each type of distribution is relatively long but the package is very efficient for generating each new random number. The package includes "classes" for generating random numbers from a number of distributions, but is easily extended to be able to generate random numbers from almost any of the standard distributions. Distributions included in the package are: Uniform Cauchy Normal Negative exponential Non-central chi square Gamma Poisson Each class includes the following functions: void Set(double) ................ Set seed (inherited from the base class) double Get() .................... Get seed (inherited from the base class) real Next() ..................... Get a new random number char* Name() .................... Name of the distribution ExtReal Mean() .................. Mean of the distribution ExtReal Variance() .............. Variance of the distribution plus the class constructor(s). The individual generators are based on "blackbox" routines which may also be used for most of the other standard distributions. In addition methods are provided for generating random numbers which are simple combinations or mixtures of random numbers provided directly by the package. The package works under Zortech C++ (1.07). It was too hard for my new version of Glockenspiel C++ for MsDos. It is 1500 lines long, too long to put on this news category. If anyone is interested and has an Internet address, I think I can send them a copy. The present copyright status is that I claim copyright but grant permission to use but not to sell. Of course, I take no legal responsibilities for errors or any misfortunes that may result from your use of the package. Please reply to SRWMRBD@WINDY.DSIR.GOVT.NZ