POV-Ray : Newsgroups : povray.beta-test : bug in rand.inc Server Time
1 Nov 2024 03:14:31 EDT (-0400)
  bug in rand.inc (Message 1 to 2 of 2)  
From: Tina Hirsch
Subject: bug in rand.inc
Date: 1 Jun 2004 16:20:01
Message: <web.40bce3e9eb8603ec1c2780980@news.povray.org>
From rand.inc included in povray 3.6 (the same as in 3.5 actually):
// Poisson distribution
// Input: Mu= mean and a random stream.
#macro Rand_Poisson(Mu, Stream)
   #local Maxtimes = 100000;  //just to be sure
   #local Cut=exp(-Mu);
   #local N=0;
   #local R=1;
   #while (R>=Cut)
      #local R=R*rand(Stream);
      #local N=N+1;
      #if(N>Maxtimes)
         #local R=Cut;
      #end
   #end
   (N)
#end

In the #while line there should be (R>Cut) and not (R>=Cut), because
1. according to some book.
2. values of Mu>=24 produce infinite loops (at least on linux).


Post a reply to this message

From: ingo
Subject: Re: bug in rand.inc
Date: 2 Jun 2004 14:37:48
Message: <Xns94FCD1DD59C39seed7@news.povray.org>
in news:web.40bce3e9eb8603ec1c2780980@news.povray.org Tina Hirsch wrote:

> In the #while line there should be (R>Cut) and not (R>=Cut), because
> 

You're right, it will be fixed.


Ingo


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.