View Single Post
  #12  
Old 11-17-2007, 06:30 AM
R Gibert R Gibert is offline
Member
 
Join Date: Jan 2006
Posts: 53
Default Re: Looking for event-based random number generator

This is very easy. Generate a set of 100 random numbers with whatever distribution you want. Compute the std dev and mean for this sample.

Now compute the ratio of the desired std dev with the sample std dev. Use this ratio to scale the 100 numbers. This will coerce the sample to have the desired std dev. Note that the sample mean will also get scaled by this ratio.

Now to get the mean to where you want it. Compute the difference between the scaled sample mean and the desired mean. Subtract this difference from each of the 100 numbers. This will not alter the std dev, but it will coerce the mean to the desired value.

This procedure will coerce the original set of 100 random numbers to the exact mean and exact std dev desired if the numbers are real numbers. If you want integers, there will be some bias depending on the mean and std dev desired, but this bias can be minimized, by a slightly more involved procedure.
Reply With Quote