From: Ian Scott <ian.m.scott@st...>  20040407 13:52:29

Ok. I won't remove vnl_sample. However, we would object to the removal of vnl_random::normal() without a lot more thought. My initial reasons: 1. Removing vnl_random::normal() will be very awkward for us in terms of fixing our code to use new API. 2. It is often useful to get 1 normal RN at a time. But normal RN's can only be generated efficiently two at a time. vnl_random::normal() stores the second normal RN so that it can be used later. Having vnl_sample_normal deal with this efficiently/simply could be a problem. 3. Peter's suggested approach (which I agree is a very nice design) is very like what the boost random library does. It separates the generation of uniformly distributed integers from the transformers that generate numbers from a particular distribution. It would seem to me that *if* we really want to go down that route, then we should use their API since it will be in C++0x. Ian. > Original Message > From: Peter Vanroose [mailto:Peter.Vanroose@...] > Sent: Wednesday, April 07, 2004 1:15 PM > To: Ian Scott > Cc: vxlmaintainers@... > Subject: RE: Random number generation > > > > I have copied mbl_mz_random to vnl_random. > > > > Unless anyone objects, I will deprecated vnl_sample, with removal > > scheduled for after VXL 1.1. > > Objection: vnl_sample serves a different purpose than vnl_random. > > * vnl_random: implementation of a random *number* generator > (typically a uniformly drawn integer between MAXINT and MAXINT) > > * vnl_sample: draw one or more samples from a given distribution. >  vnl_sample_uniform draws n samples from a uniform distribution > in the interval [a,b]. This is of course just a matter of a > linear transformation from vnl_random outputs. >  vnl_sample_normal drawn n samples from a normal (Gaussian) > distribution. This looks more tricky to implement from an rng > but actually this is "standard practice", see the implementation > of vnl_random::normal(). > (vnl_sample_normal() uses a not so standard implementation ;) >  There could be interest in other sampling functions, e.g., > to sample a binomial distribution or a Poisson distribution > etc. This also belongs in vnl_sample, not in vnl_random. > > In short, vnl_sample is a statistical tool, while vnl_random is > just a general purpose randomisation tool. > > So I propose to reimplement vnl_sample based on vnl_random, > and to remove vnl_random::normal(), actually rename it to > vnl_sample_normal. > > Comments? > > >  Peter. > 