POV-Ray : Newsgroups : povray.general : Is it me or does rand(n) loop ? : Re: Is it me or does rand(n) loop ? Server Time
5 Aug 2024 02:24:06 EDT (-0400)
  Re: Is it me or does rand(n) loop ?  
From: Christopher James Huff
Date: 19 Dec 2002 10:47:10
Message: <chrishuff-5D4E58.10421619122002@netplex.aussie.org>
In article <web.3e00bfe092e939f7f765b2b40@news.povray.org>,
 "BlackRose" <nomail@nomail> wrote:

>     But now I'm confused. I apologize for bothering you about this, but the
> documentation wasn't very clear/understandable to me, so I was wondering
> when and to what extent reusing variable names is acceptable, and how that
> relates to what is going on when I define and use macros and/or other
> objects. (Did that make sense ?)

Look up the documentation on local variables.


> Also, if I call the macro repeatedly, does the random number 
> generator i'm using within the macro get reset each time ? What 
> exactly goes on with the different rand-number streams when I seed 
> it, and later call em ?

I don't see why it is so confusing...you call seed() to set up a stream. 
If you do that in the macro, it gets done every time the macro is 
called, just like any other code in the macro. It isn't wrong, but it is 
almost definitely not what you want: you will always get the same string 
of numbers from a given seed value.
What you want to do is to define the stream once and then leave it alone.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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