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:18:14 EDT (-0400)
  Re: Toward a less-lame rand() function.  
From: Kenneth
Date: 20 May 2009 02:10:00
Message: <web.4a139d922a89ae6df50167bc0@news.povray.org>
"clipka" <nomail@nomail> wrote:
> "Kenneth" <kdw### [at] earthlinknet> wrote:
> > IIRC, you mentioned something several ago (to me) that seed() chooses it
> > 'starting point' in the stream in a very complex fashion...not just 'linearly'
> > in the stream.  IOW, the difference between seed(23) and seed(24) isn't just
> > jumping one value ahead in the 2^32 stream. Is my thinking correct?
>
> Yes. In a first approach, think of seeding the RNG as fast-forwarding to the
> position in the 2^32 stream at which that very number appears...
>
> Admittedly, this is a bit oversimplified: In real-life RNGs, that 23 is almost
> always hidden from your view, and what you get when pulling from the stream is
> actually some hash of it...
>

Interesting! So as I understand it--again using seed(23) and seed(24) as
examples--the '23' and the '24' are definitely not next to each other in the
2^32 stream, but are distributed *who knows where* (admittedly a simplified way
of expressing the situation.) Correct so far?

Then (guessing further), the rand() calls from those two seeds 'start up' at the
pseudo-random values following the pseudo-randomly-dispersed 23 and 24 in the
stream? (I may be *grossly* oversimplifying here.)

If my simplistic assumptions/understandings are correct, then it seems to me
that it all still begs the question of why there are repetitive patterns when
using seed(frame_number) in animations--albeit when calling only one rand()
value per seed. I don't mean to beat this poor old horse to death, but
seed(frame number 23) and seed(frame number 24) should--as far as I understand
things--pick up the 2^32 stream at wildly differing locations (with completely
different 'blocks' of random values that rand() then picks out--even just one
rand() call.) If the 2^32 values in the stream are indeed pseudo-randomly
created, then from where does a semi-repeating pattern arise?

This is all semi-informed guesswork, so *please* correct me where appropriate!
;-) I'm still trying mightily to get a clear--but simple!--picture of how seed
works, and what causes those patterns.

Ken W.


Post a reply to this message

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