# How to generate a random number including mathematical dispersion?

I need to generate not completely random number that would be influenced by functional dependency.

Current solution I was looking was to give an algorithm value of statistical dispersion or spread if may and an average and derive the integer from there since formula for dispersion looks like this: $f(x) = \frac{(x_1-\overline{X})^2+(x_2-\overline{X})^2+...+(x_n-\overline{X})^2}{n}$

Is there any better way of doing this say using mode or median?

EDIT: I am creating a simulation for Theory of Constrictions. In this simulations user is allowed to input the range for every 'stations' random throughput yet in reality these values are not random they are in normalized distribution with certain deviation to one or another side.

-
What do you mean by functional dependency? Do you mean that the random draw should have a certain mean and standard deviation? Do you want the draw to come from some specific distribution? – response May 20 '13 at 15:37
For now I ma just focusing on the fist option (random draw should have a certain mean and standard deviation) yet later on I will look for have more complete control of the ranges value is generated in. – PovilasID May 20 '13 at 15:42
Typically, that is not enough to draw a random number and you need to impose more structure. Either specify that the distribution is a normal or specify a range and require a uniform draw. – response May 20 '13 at 15:44
What about providing distribution and average? My goal for now is to generate random number with hither probability in certain are. I was hoping to make that distribution of the probability of generated value would look somewhat like dependent on median or mode en.wikipedia.org/wiki/File:Comparison_mean_median_mode.svg – PovilasID May 20 '13 at 15:54
It may perhaps be helpful to describe your original context and what you are trying to accomplish. A distribution and an average by itself is typically not enough. – response May 20 '13 at 16:24