1. ## Quick math question

Ok, I wasn't sure where to post this so I'll try GD. If the mods feel it belongs in the c++ forum, then thats ok.

I am trying to write a function but am having problems with the math concept of it. What I want is to have a function return a random number based on the following four parameters: the minimum value it can be, the maximum value it can be, and a median and slope number that I'll explain in a second. Basically what I have in mind is something that resembles a bell curve function. The median number is the highest point in the curve and will be the most likely number returned by the function. Depending on how steep the slope parameter is, the lower the probability of getting a number farther away from the median. So for convenience sake, lets say that the possible values of the slope are 0%-100%. Then 99% means that it is extremely unlikely to get a number far away from the median, and you are almost guaranteed of getting the median or a number right next to the median. As the slope gets smaller, the probability of finding a number farther away increases, until you get a slope of 0% which means all numbers between the max and min are equally possible.

An example would be something like:
min:2 max:8 median:5 slope:75%
has this probability which is arbitrary at the moment (doesn't have to be these exact percentages):
return 2:3% 3:7% 4:15% 5:50% 6:15% 7:7% 8:3%

Lately I've come across quite a few uses for something like this. I'm just looking for some time of general equation or help on how to write something small like this. Don't need code, just a quick kick in the right direction will do

2. Sounds like you want a normal distribution or similar, (didn't have time to read all your requirements - leaving now).

3. You know, I always hated those long problems that they gave you in school on math tests, like, "Billy and Jane (and they always had names like that), were going camping (What? Together? With no adults? In middle school? Sickos...) and wanted to get the best deal on granola bars..." and the story goes on, but has anyone noticed, that Billy and Jane always spend hours just to save a few cents on a stupid pack of granola bars? If it tastes good buy it! And what about those problems where you have to figure out how long it's going to for the bath to fill up based on how fast water's coming in, and how fast it's going out. That really doesn't teach little kids to waste water, now does it? Yes, I know that has nothing to do with the question, but don't you think it's a valid point?

4. Um... ok sean

Thanks adrianxw, that is pretty much what I needed. I worked on it last night and came up with a random number generator that uses normal distribution and got it working. Thanks!