POV-Ray : Newsgroups : povray.general : QUESTION: Random Seed deriving from Time? Server Time
20 Apr 2024 09:30:17 EDT (-0400)
  QUESTION: Random Seed deriving from Time? (Message 11 to 14 of 14)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Alain
Subject: Re: QUESTION: Random Seed deriving from Time?
Date: 19 Feb 2018 17:00:36
Message: <5a8b4904$1@news.povray.org>
Le 18-02-18 à 21:45, Sven Littkowski a écrit :
> On 18.02.2018 21:22, clipka wrote:
>> Am 18.02.2018 um 22:24 schrieb Sven Littkowski:
>>> I am trying this
>>> #declare MyRandomer   = seed(CURRENTTIMESTAMP);
>>>
>>> and this
>>> #declare MyRandomer   = seed(msg:CURRENTTIMESTAMP);
>>>
>>> but only errors. please assist. Thanks!
>>
>> Out of pure curiosity: How did you come up with that particular syntax?
>>
>>
>> The keyword you're looking for is `now`, which returns the time elapsed
>> since 2000-01-01, 00:00:00 GMT, in (fractional) days.
>>
>> Note that since `seed()` converts its parameter to an integer, you need
>> to scale the result of `now` to whatever granularity you need for the
>> seed. For instance, for the seed to change every hour, use:
>>
>>      #declare MyRandomer = seed(now * 24);
>>
>> Note that the value of `now` changes even during parsing.
>>
>> Also note that the resolution of the underlying timer may vary between
>> systems, and may be as poor as a second per tick.
>>
>>
>> Finally, due to the nature of the inbuilt random number generator, the
>> first few values pulled from the generator may remain somewhat similar
>> between consecutive seeds, so you may want to choose your granularity
>> somewhat higher than absolutely necessary, or always discard the first
>> few random numbers (maybe a dozen or so) pulled from the generator.
>>
> Hi.
> 
> The POV-Ray help file did not mention "now", and so I started to search
> online but without knowing what exact keywords to look for. Eventually,
> I came accross a web page thatwas about POV-Ray and also featured
> "CURRENTTIMESTAMP". I believed it was more about programming then
> anything I could use in a scene, but i wanted to give a try, and that's
> how I got these variations you saw.
> 
> I use "now" but the renders still look the same, like the seed would
> remain the same. I make the renders in intervals of less than a minute.
> Thus, a seed that changes each second would be nice.
> 
> ---
> Diese E-Mail wurde von AVG auf Viren geprüft.
> http://www.avg.com
> 

Try something like :
#declare SecondPerDay = 60*60*24; //or 86400
#declare MyRandomer = seed(now * SecondPerDay);

You can artificially make your seconds smaller by increasing the value 
to your liking :
#declare Over = 1.5;
#declare SecondPerDay = 60*60*24*Over;

Next, use some dumy uses to skip a few initial values from the stream.


Post a reply to this message

From: Alain
Subject: Re: QUESTION: Random Seed deriving from Time?
Date: 19 Feb 2018 17:05:01
Message: <5a8b4a0d$1@news.povray.org>
Le 18-02-19 à 09:18, Sven Littkowski a écrit :
> Thanks, that is what was needed!
> 
> I think, the SEED chapter of the POV-Ray help file really need to
> mention "now" and "now * 24*60*60", as many users might be in need of
> irregularly random renders. "Now" is not even mentioned at all there,
> now does the key "F1" open any content help for "now".
> 
> In fact, even with many existing keywords in the help file, only this
> happens when clicking them: the HELP opens a new page, but that is just
> the begin of the documentation, not the part dealing with that
> particular keyword.
> 
> ---
> Diese E-Mail wurde von AVG auf Viren geprüft.
> http://www.avg.com
> 

The included help was not completely updated since version 3.6.0, and 
now did not exist back then.
You may have beter results using the wiki based help.


Post a reply to this message

From: Sven Littkowski
Subject: Re: QUESTION: Random Seed deriving from Time?
Date: 20 Feb 2018 00:30:57
Message: <5a8bb291@news.povray.org>
Thanks. For me it is fine, to use seconds as smallest unit. Nonetheless,
I am learning something new with your answer.

But I want to say, that I appreciate a lot the good will and great
spirit in our group!

---
Diese E-Mail wurde von AVG auf Viren geprüft.
http://www.avg.com


Post a reply to this message

From: Sven Littkowski
Subject: Re: QUESTION: Random Seed deriving from Time?
Date: 20 Feb 2018 00:31:37
Message: <5a8bb2b9$1@news.povray.org>
Hopefully, there's a way to convert the Wiki into a functioning Help
file.   ;-)

---
Diese E-Mail wurde von AVG auf Viren geprüft.
http://www.avg.com


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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