|
![](/i/fill.gif) |
Kenneth <kdw### [at] earthlink net> wrote:
> "Kenneth" <kdw### [at] earthlink net> wrote:
> > "Chris B" <nom### [at] nomail com> 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
|
![](/i/fill.gif) |