protected float DoubleDistribution(float min, float max, float delta, DistributionDelegate method) { if (delta != _defaultValue && delta > max - min) { Debug.LogError("Overlap is too big. Using default overlap"); delta = _defaultValue; } if (delta == _defaultValue) { delta = 1; } float mean = (max + min) * 0.5f; _firstOverlap = !_firstOverlap; if (_firstOverlap) { return(method(min, mean + delta, _defaultValue)); // Next(min , mean + delta, _defaultValue); } else { return(method(mean - delta, max, _defaultValue)); //Next(mean - delta , max ,_defaultValue); } }
protected void SetDistributionMethod(Distribution distType) { _distType = distType; switch (distType) { case Distribution.Gaussian: DistributionMethod = new DistributionDelegate(Gaussian); break; case Distribution.DoubleGaussian: DistributionMethod = new DistributionDelegate(DoubleGaussian); break; case Distribution.Exponential: DistributionMethod = new DistributionDelegate(Exponential); break; case Distribution.InverseExponential: DistributionMethod = new DistributionDelegate(InvExponential); break; case Distribution.DoubleExponential: DistributionMethod = new DistributionDelegate(DoubleExponential); break; case Distribution.Triangular: DistributionMethod = new DistributionDelegate(Triangular); break; case Distribution.DoubleTriangular: DistributionMethod = new DistributionDelegate(DoubleTriangular); break; default: break; } }
protected float DoubleDistribution(float min, float max, float delta, DistributionDelegate method) { if(delta != _defaultValue && delta > max - min) { Debug.LogError("Overlap is too big. Using default overlap"); delta = _defaultValue; } if(delta == _defaultValue) { delta = 1; } float mean = (max + min) * 0.5f; _firstOverlap = !_firstOverlap; if(_firstOverlap) { return method(min, mean + delta, _defaultValue);// Next(min , mean + delta, _defaultValue); } else { return method(mean - delta, max, _defaultValue);//Next(mean - delta , max ,_defaultValue); } }