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:25:41 EDT (-0400)
  Re: problem: repeating rand patterns using seed in animation  
From: Warp
Date: 24 Jan 2009 06:00:42
Message: <497af4da@news.povray.org>
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


Post a reply to this message

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