I need help in defining the type of distribution used in software so that I could use some standard distribution library for this purpose. I apologize for not using proper terms. It takes "center" value and an alpha parameter (0 to 1) and produces N values within a given range, so that values are "clustered" around this "center" value. The less alpha the less they are "centered".
For example, if I feed a range of 1-5 with center at 4, alpha=0.5 and ask for 20 values the result will look something like this:
1:1 times
2:3 times
3:4 times
4:7 times
5:5 times
You get the idea. Thanks!
P.S. In case it might help, I provided some extracts from code
The code for probability density function:
private function assessProbabilityDensityFunction(){
$probabilityDensityFunction=array();
for ($i = 0; $i < $this->valueRange->getNumberOfValues(); $i++)
$probabilityDensityFunction[$i] = $this->probabilityFunction() * $this->probabilityCenteredCoefficient($i);
return $probabilityDensityFunction;
}
private function probabilityFunction(){
return (1 - $this->settings->getAlpha()) / (1 - pow($this->settings->getAlpha(), $this->valueRange->getNumberOfValues() - $this->CentralValueSerialNumber() + 1) + $this->settings->getAlpha() - pow($this->settings->getAlpha(), $this->CentralValueSerialNumber()));
}
private function distanceFromCentralValue($serialNumber){
return abs($this->CentralValueSerialNumber() - $serialNumber - 1);
}
And here's the cumulative function code
private function assessCumulativeDistributionFunction(){
$cumulativeDistributionFunction = array();
$cumulativeDistributionFunction[0] = $this->probabilityFunction->getValue(0);
for ($i = 1; $i < $this->getValueRange()->getNumberOfValues(); $i++)
$cumulativeDistributionFunction[$i] = $cumulativeDistributionFunction[$i - 1] + $this->probabilityFunction->getValue($i);
return $cumulativeDistributionFunction;
}
And here's how we get distributed values
public function getValue(){
return $this->multinomialDistribution()+$this->cumulativeFunction->getValueRange()->getFromValue();
}
private function multinomialDistribution(){
$rnd= lcg_value(); // random (0,1)
for ($i=0; $i<$this->cumulativeFunction->getValueRange()->getNumberOfValues(); $i++)
if ($this->cumulativeFunction->getValue($i) > $rnd) return $i;
throw new Exception("Should always return a value");
}