POV-Ray : Newsgroups : povray.documentation.inbuilt : (seed) could use a better explanation Server Time
16 Apr 2024 19:07:15 EDT (-0400)
  (seed) could use a better explanation (Message 11 to 16 of 16)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Kenneth
Subject: Re: (seed) could use a better explanation
Date: 11 Oct 2005 02:55:00
Message: <web.434b60876c2f1bf914d4b080@news.povray.org>
"Ken Hutson" <ken### [at] goettingcom> wrote:
> Kenneth,
> There is some intresting reading on pseudo-random number generation at
> www.wikipedia.org
> Kenneth Hutson

Thanks, I'll give that a look!

Ken


Post a reply to this message

From: Kenneth
Subject: Re: (seed) could use a better explanation
Date: 11 Oct 2005 03:30:01
Message: <web.434b69046c2f1bf914d4b080@news.povray.org>
Oh...one other TINY little question, mostly out of curiosity: What is the
"length" of the integer value that can be placed into SEED?  That is, how
many digits long?  Did I overlook that in the docs somewhere? From Warp's
discussion, I *suspect* it is 32, but that's a guess. Curious minds want to
know!  ; - )

Ken


Post a reply to this message

From: Warp
Subject: Re: (seed) could use a better explanation
Date: 11 Oct 2005 04:57:26
Message: <434b7e76@news.povray.org>
Kenneth <kdw### [at] earthlinknet> wrote:
> Oh...one other TINY little question, mostly out of curiosity: What is the
> "length" of the integer value that can be placed into SEED?  That is, how
> many digits long?  Did I overlook that in the docs somewhere? From Warp's
> discussion, I *suspect* it is 32, but that's a guess. Curious minds want to
> know!  ; - )

  A 32-bit number, which can represent 2^32 different values, contains
32 *binary* digits (ie. 0 or 1).
  In decimal the maximum value of a 32-bit number is 4294967295 (10 digits).

  If you give seed() a larger number it will probably just get truncated
(IOW the number modulo 4294967296 will be used).

-- 
                                                          - Warp


Post a reply to this message

From: Kenneth
Subject: Re: (seed) could use a better explanation
Date: 11 Oct 2005 23:55:01
Message: <web.434c87f56c2f1bfd82bb7c00@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:

>   A 32-bit number, which can represent 2^32 different values, contains
> 32 *binary* digits (ie. 0 or 1).
>   In decimal the maximum value of a 32-bit number is 4294967295 (10 digits).

>                                                           - Warp

Thanks.  BTW, the clue was sitting there right in front of me, and I didn't
*see* it. Sorry.

Warp wrote...
>      The seed value (which is a 32-bit integer) jumps pseudorandomly over
>      its entire value space (ie. between 0 and 2^32-1) and the value returned
>      by rand() is simply calculated from this seed value.

Ken


Post a reply to this message

From: Kenneth
Subject: Re: (seed) could use a better explanation
Date: 27 Oct 2005 16:20:00
Message: <web.4361355d6c2f1bf71fa4210@news.povray.org>
"Kenneth" <kdw### [at] earthlinknet> wrote:
> ...I think I'll try my own hand at coming up with some meatier
> explanations. If  I manage to do so, I'll post them for vetting.
>

I hereby offer alternate wordings of POV's definitions
(hopefully more English-friendly), specifically for new users -- those who
are just coming across the definitions for the first time. Personally, I
see a need for that. I've shamelessly borrowed from all that has been
posted here, but the paraphrasing is my own, so I'm the only one to blame
if something isn't correct.
-----
SEED(I)   Works together with RAND, for the creation of random values.  From
any integer value placed into it, SEED() effectively creates a long
pseudo-random stream of individual numbers, each between 0 and 1 inclusive.
 The integer can range from 0 up to 4294967295  (i.e., 2 ^ 32 - 1.) A float
is allowed, but will be truncated to an integer.  Each and every value will
effectively produce a completely different stream.  (Though not technically
correct, the end result is practically the same.) Each subsequent call from
RAND will then "withdraw" a different value from this stream.  SEED (I)
must first be initialized (#declared) as a variable before RAND can call on
it. Any number of streams can be initialized in your scene's code.

RAND(V)  Works together with SEED. Each time RAND() is called -- using
SEED's #declared variable name -- a pseudo-random float value is
"withdrawn" from the SEED stream, in the range of 0 to 1 inclusive. This
process is itself psuedo-random; each RAND() call will "jump" all over the
entire stream to choose a value. The two working together produce a good
approximation of randomness.  This random number creation is independent of
the computer platform or OS; for any integer placed into SEED(), the exact
same stream -- as well as its RAND() value(s) -- will be returned,
regardless of computer platform. This allows scene files to be rendered
identically on different platforms.

-------
Perhaps a bit wordy, but,...is this more clear? Less clear? The same?

I invite comments, criticisms, additions or further clarifications.

Ken


Post a reply to this message

From: Warp
Subject: Re: (seed) could use a better explanation
Date: 28 Oct 2005 10:30:19
Message: <436235fb@news.povray.org>
Kenneth <kdw### [at] earthlinknet> wrote:
> for any integer placed into SEED()

  That expression is somewhat incorrect because you do not place anything
into SEED().
  seed() is just a function which returns a seed value (which is calculated
from the parameter given to it). This seed value can then be given
(repeatedly) to the rand() function.

  Seed values are independent in that they do not interfere with each
other (which is a rather handy feature).

-- 
                                                          - Warp


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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