gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
Serious buxfixes in Random::gamma() and Random::pareto()
0 1 0
default
1 file changed with 2 insertions and 2 deletions:
↑ Collapse diff ↑
Ignore white space 12 line context
... ...
@@ -792,13 +792,13 @@
792 792
	else 
793 793
	  {
794 794
	    xi=1.0-std::log(V1);
795 795
	    nu=V0*std::exp(-xi);
796 796
	  }
797 797
      } while(nu>std::pow(xi,delta-1.0)*std::exp(-xi));
798
      return theta*(xi-gamma(int(std::floor(k))));
798
      return theta*(xi+gamma(int(std::floor(k))));
799 799
    }
800 800
    
801 801
    /// Weibull distribution
802 802

	
803 803
    /// This function generates a Weibull distribution random number.
804 804
    /// 
... ...
@@ -816,13 +816,13 @@
816 816
    /// 
817 817
    ///\param k shape parameter (<tt>k>0</tt>)
818 818
    ///\param x_min location parameter (<tt>x_min>0</tt>)
819 819
    ///
820 820
    double pareto(double k,double x_min)
821 821
    {
822
      return exponential(gamma(k,1.0/x_min));
822
      return exponential(gamma(k,1.0/x_min))+x_min;
823 823
    }  
824 824
      
825 825
    /// Poisson distribution
826 826

	
827 827
    /// This function generates a Poisson distribution random number with
828 828
    /// parameter \c lambda.
0 comments (0 inline)