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 12:28:21 EDT (-0400)
  Re: problem: repeating rand patterns using seed in animation  
From: Kenneth
Date: 24 Jan 2009 10:15:00
Message: <web.497b2f95b528db0df50167bc0@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> Kenneth <kdw### [at] earthlinknet> wrote:
> > I've run into an interesting and totally unexpected situation in v3.6.1 while
> > animating, trying to produce some random values from frame to frame. I'm seeing
> > repeating patterns in the values; nothing that I try eliminates them.
>
>   POV-Ray uses a linear congruential generator as RNG, and those tend to
> produce patterns in certain situations.
>
>   What you can do to get a more random sequence is this:
>
> 1) On the first frame seed the RNG with whatever value (eg. 0).
> 2) Then pull a value with rand(), multiply it by a large value and
>    #write it to a file. Then use the value in your scene in any way
>    you want.
> 3) In subsequent frames #read that value from the file and give it to seed()
> 4) Repeat the steps 2 and 3.
>
> --
>                                                           - Warp

Another interesting idea; thanks. I see that it would produce what's needed:
Each subsequent frame's seed is using the rand() value from the previous frame
for ITS value; so even though there are patterns, each new frame sees what
amounts to a different pattern (if I'm thinking correctly.)  Nice.


Post a reply to this message

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