|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |