POV-Ray : Newsgroups : povray.general : problem: repeating rand patterns using seed in animation : Re: problem: repeating rand patterns using seed in animation Server Time
30 Jul 2024 20:23:35 EDT (-0400)
  Re: problem: repeating rand patterns using seed in animation  
From: Warp
Date: 25 Jan 2009 07:43:57
Message: <497c5e8c@news.povray.org>
Kenneth <kdw### [at] earthlinknet> wrote:
> "Kenneth" <kdw### [at] earthlinknet> wrote:
> > "Chris B" <nom### [at] nomailcom> wrote:
> > >
> > > #declare P = seed(1);
> > > #local I = 0;
> > > #while (I<frame_number)
> > > #local ThrowAway = rand(P);
> > > #declare I = I + 1; // added by Kenneth  ;-)
> > > #end
> >
> > That's quite interesting, and it makes great sense--it pulls a nice random value
> > for each frame. I'll try it!

> Yes indeed, it works as advertised. Wonderful! Who cares if it wastes some rand
> values; that's what computers are FOR! :-P

  Actually it doesn't waste any values. In fact, the end result is very
similar to the #write/#read solution, but without having to use the temporary
file.

  Or it is, if you only want one random value per frame. If you want several
random values per frame, then you have to "read away" all the random values
from the RNG stream that have been used in previous frames.

  If the number of random numbers generated per frame varies from frame
to frame, then it can become difficult to achieve the desired effect
without #write/#read.

-- 
                                                          - Warp


Post a reply to this message

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