diff scripts/statistics/distributions/gamrnd.m @ 6777:4775fc1aa728

[project @ 2007-07-18 16:32:51 by dbateman]
author dbateman
date Wed, 18 Jul 2007 16:32:52 +0000
parents 20c48710b2c7
children 6304d9ea0a30
line wrap: on
line diff
--- a/scripts/statistics/distributions/gamrnd.m	Tue Jul 17 15:22:47 2007 +0000
+++ b/scripts/statistics/distributions/gamrnd.m	Wed Jul 18 16:32:52 2007 +0000
@@ -82,7 +82,7 @@
     if (find (!(a > 0) | !(a < Inf) | !(b > 0) | !(b < Inf)))
       rnd = NaN * ones (sz);
     else
-      rnd = randg(a,sz)/b;
+      rnd = b .* randg(a, sz);
     endif
   else 
     k = find (!(a > 0) | !(a < Inf) | !(b > 0) | !(b < Inf));
@@ -91,7 +91,7 @@
     endif
     k = find ((a > 0) & (a < Inf) & (b > 0) & (b < Inf));
     if (any (k))
-      rnd(k) = randg(a(k),size(k))/b(k);
+      rnd(k) = b(k) .* randg(a(k), size(k));
     endif
   endif