POV-Ray : Newsgroups : povray.binaries.images : Toward a less-lame rand() function. : Re: Toward a less-lame rand() function. Server Time
1 Aug 2024 00:16:45 EDT (-0400)
  Re: Toward a less-lame rand() function.  
From: Kenneth
Date: 18 May 2009 02:25:01
Message: <web.4a10fec32a89ae6df50167bc0@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:

>
> If you have a known number of random numbers being used in each frame, you
> can seed once at frame 0, then on each subsequent frame, generate
> frame_number time known_random_number_count random numbers, and then pick up
> the stream from there. Use a while loop in SDL to generate calls to rand(),
> in other words.

If I understand you correctly, that's the (good!) idea that Chris B. came up
with here (which was also linked-to earlier):
http://news.povray.org/povray.general/message/%3C497a49fd%241%40news.povray.org%3E/#%3C497a49fd%241%40news.povray.org%3


>
> There's no good reason to believe the first number you generate after
> seeding the RNG looks especially random for different seeds...
>

I think that one has to be familiar with the arcania of RNGs and such to fully
understand why that may be so. (I don't count myself in that category,
unfortunately--it's all *still* over my head.) I would imagine that the typical
POV user probably believes--at least in the early stages of using the
program--that each-and-every different seed value *does* generate a nicely
psuedo-random stream (which it appears to do, of course--in a static,
non-animated scene. I think! With the possible exception of pulling only ONE
rand() value per seed--which is itself kind of idiotic: Why set up a bunch of
different seeds in a static scene if you're only using one rand() call per
seed?!) The problem of 'patterns' really only seems to show its ugly self when
one gets into animation. Yet there's nothing currently in the POV documentation
that explains any of this.  Alas, most of us have to learn about this situation
the hard way.

KW


Post a reply to this message

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