implementation of CalcUniform() and CalcGaus