POV-Ray : Newsgroups : povray.general : A quick rand() question... Server Time
28 Nov 2024 00:45:38 EST (-0500)
  A quick rand() question... (Message 1 to 10 of 10)  
From: Tim Nikias
Subject: A quick rand() question...
Date: 22 Oct 2007 12:22:57
Message: <471cce61$1@news.povray.org>
Hey all!

I know the rand()-Stream ist just pseudo-random, not purely random. I 
use the same seed-Value, I get the same order of random-values between 0 
and 1, so far, so good.

What's with different OS'? I've got a WinXP-PC and recently also got a 
MacBook Pro (Intel Based). Since POV-Ray doesn't run natively on 
Intel-Based MacBooks (yet), I'm using MegaPOV to have something running 
there. ;-) Of course, since it's MegaPOV, the random-stream might be 
different again, but if/once the Intel-Based POV-Ray for Mac gets 
released, will the streams be identical?

You may argue that this question is purely scientific, when I use random 
streams, I'm looking for random-input, so asking how determined it is 
might be kinda stupid... Anyways, I figured I'd just ask. Gotta keep 
this random-stuff in mind when designing/writing my next images.

Point is: Once there's a new POV-Ray, or you switch to a different OS, 
the image might change, and when it's about re-rendering the same 
image... I might have to implement my own, SDL-based random thingy, 
that'd be a trick to be sure the stuff I want random ("but not really 
random") is more or less determined...

Ah, sorry, I'm beginning to babble, I'll stop here. Back to the 
question: How determined are the random-streams when talking cross-OS?

Regards,
Tim

-- 
aka "Tim Nikias"
Homepage: <http://www.nolights.de>


Post a reply to this message

From: Jan Dvorak
Subject: Re: A quick rand() question...
Date: 22 Oct 2007 14:31:17
Message: <471cec75$1@news.povray.org>
Tim Nikias napsal(a):
> Hey all!
> 
> I know the rand()-Stream ist just pseudo-random, not purely random. I 
> use the same seed-Value, I get the same order of random-values between 0 
> and 1, so far, so good.
> 
> What's with different OS'? I've got a WinXP-PC and recently also got a 
> MacBook Pro (Intel Based). Since POV-Ray doesn't run natively on 
> Intel-Based MacBooks (yet), I'm using MegaPOV to have something running 
> there. ;-) Of course, since it's MegaPOV, the random-stream might be 
> different again, but if/once the Intel-Based POV-Ray for Mac gets 
> released, will the streams be identical?
> 
> You may argue that this question is purely scientific, when I use random 
> streams, I'm looking for random-input, so asking how determined it is 
> might be kinda stupid... Anyways, I figured I'd just ask. Gotta keep 
> this random-stuff in mind when designing/writing my next images.
> 
> Point is: Once there's a new POV-Ray, or you switch to a different OS, 
> the image might change, and when it's about re-rendering the same 
> image... I might have to implement my own, SDL-based random thingy, 
> that'd be a trick to be sure the stuff I want random ("but not really 
> random") is more or less determined...
> 
> Ah, sorry, I'm beginning to babble, I'll stop here. Back to the 
> question: How determined are the random-streams when talking cross-OS?
> 
> Regards,
> Tim
> 
It's not a bad question at all. There are multiple streams for the 
purpose that you can change a part of the scene without changing any 
random values further down the code so I guess the generator is 
cross-platform also.
What I'd like to see is a stream that generates new values for each new 
render. I have not succeeded using start_chrono as the seed.


Post a reply to this message

From: Trevor G Quayle
Subject: Re: A quick rand() question...
Date: 22 Oct 2007 16:10:00
Message: <web.471d0335ce8620b7c150d4c10@news.povray.org>
Jan Dvorak <jan### [at] centrumcz> wrote:
> What I'd like to see is a stream that generates new values for each new
> render. I have not succeeded using start_chrono as the seed.

Perhaps the easiest way to do this is via a text file that is read and
written to with each scene parse.

Just read in the current value from the text file and increment it, use it
and write the new one back to the text file, ready for the next run.

-tgq


Post a reply to this message

From: Trevor G Quayle
Subject: Re: A quick rand() question...
Date: 22 Oct 2007 16:30:01
Message: <web.471d071dce8620b7c150d4c10@news.povray.org>
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> Jan Dvorak <jan### [at] centrumcz> wrote:
> > What I'd like to see is a stream that generates new values for each new
> > render. I have not succeeded using start_chrono as the seed.
>
> Perhaps the easiest way to do this is via a text file that is read and
> written to with each scene parse.
>
> Just read in the current value from the text file and increment it, use it
> and write the new one back to the text file, ready for the next run.
>
> -tgq

Actually, since you seem you may be using megaPOV, you can try:

#declare AA=seed(val(date("%Y%m%d%H%M%S")));

This should give you a unique seed every time you run it. It seeds from an
integer concatenated from: Year,Month,Day,Hour,Minute,Sec.

-tgq


Post a reply to this message

From: Warp
Subject: Re: A quick rand() question...
Date: 22 Oct 2007 16:47:15
Message: <471d0c52@news.povray.org>
Tim Nikias <JUS### [at] gmxnetware> wrote:
> Of course, since it's MegaPOV, the random-stream might be 
> different again, but if/once the Intel-Based POV-Ray for Mac gets 
> released, will the streams be identical?

  POV-Ray uses its own random number generator function (a linear
congruential generator, if you are interested; see wikipedia).
There's no reason why it would give different values in different
systems.

> You may argue that this question is purely scientific, when I use random 
> streams, I'm looking for random-input, so asking how determined it is 
> might be kinda stupid...

  No. Always getting the same stream of numbers every time is very useful
for many purposes.

-- 
                                                          - Warp


Post a reply to this message

From: Tim Nikias
Subject: Re: A quick rand() question...
Date: 22 Oct 2007 18:02:29
Message: <471d1df5$1@news.povray.org>
Warp wrote:
> Tim Nikias <JUS### [at] gmxnetware> wrote:
>> Of course, since it's MegaPOV, the random-stream might be 
>> different again, but if/once the Intel-Based POV-Ray for Mac gets 
>> released, will the streams be identical?
> 
>   POV-Ray uses its own random number generator function (a linear
> congruential generator, if you are interested; see wikipedia).
> There's no reason why it would give different values in different
> systems.

Hm, I seem to recall that I once rerendered an image that I made with 
POV 3.1 and rendering it now looks different. But maybe I changed 
something else as well, thus mixing up the stream...

>> You may argue that this question is purely scientific, when I use random 
>> streams, I'm looking for random-input, so asking how determined it is 
>> might be kinda stupid...
> 
>   No. Always getting the same stream of numbers every time is very useful
> for many purposes.

Yup, just need to make sure that you'll actually get the same numbers 
even at a later point. ;-)

Regards,
Tim

-- 
aka "Tim Nikias"
Homepage: <http://www.nolights.de>


Post a reply to this message

From: Bryan Valencia
Subject: Re: A quick rand() question...
Date: 22 Oct 2007 19:26:14
Message: <471d3196$1@news.povray.org>
Why is there nothing in the help about the Date function?

-- 
Bryan Valencia

"I'd rather live with false hope than with false despair."


Post a reply to this message

From: Warp
Subject: Re: A quick rand() question...
Date: 22 Oct 2007 19:32:50
Message: <471d3322@news.povray.org>
Bryan Valencia <209### [at] gmailcalm> wrote:
> Why is there nothing in the help about the Date function?

  Because there's no date function in the official POV-Ray?

-- 
                                                          - Warp


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: A quick rand() question...
Date: 23 Oct 2007 05:19:48
Message: <471dbcb4@news.povray.org>
Tim Nikias wrote:
> Hey all!
> 
> I know the rand()-Stream ist just pseudo-random, not purely random. I
> use the same seed-Value, I get the same order of random-values between 0
> and 1, so far, so good.
> 
> What's with different OS'?

There is no concern, the random number sequence will always be the same.

	Thorsten


Post a reply to this message

From: Alain
Subject: Re: A quick rand() question...
Date: 23 Oct 2007 11:23:48
Message: <471e1204$1@news.povray.org>
Tim Nikias nous apporta ses lumieres en ce 2007/10/22 18:02:
> Warp wrote:
>> Tim Nikias <JUS### [at] gmxnetware> wrote:
>>> Of course, since it's MegaPOV, the random-stream might be different 
>>> again, but if/once the Intel-Based POV-Ray for Mac gets released, 
>>> will the streams be identical?
>>
>>   POV-Ray uses its own random number generator function (a linear
>> congruential generator, if you are interested; see wikipedia).
>> There's no reason why it would give different values in different
>> systems.
> 
> Hm, I seem to recall that I once rerendered an image that I made with 
> POV 3.1 and rendering it now looks different. But maybe I changed 
> something else as well, thus mixing up the stream...
> 
>>> You may argue that this question is purely scientific, when I use 
>>> random streams, I'm looking for random-input, so asking how 
>>> determined it is might be kinda stupid...
>>
>>   No. Always getting the same stream of numbers every time is very useful
>> for many purposes.
> 
> Yup, just need to make sure that you'll actually get the same numbers 
> even at a later point. ;-)
> 
> Regards,
> Tim
> 
Maybe the random algorythm have changed between 3.1 and 3.6. After all, the 
default noise generator did change between 3.5 and 3.6.

-- 
Alain
-------------------------------------------------
Politicians are like diapers, they should be changed often and for the same reason.
	Bob Monkhouse


Post a reply to this message

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