POV-Ray : Newsgroups : povray.general : Simple trick for getting different random numbers in each render Server Time
11 Aug 2024 01:15:09 EDT (-0400)
  Simple trick for getting different random numbers in each render (Message 11 to 20 of 21)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 1 Messages >>>
From: Alan Kong
Subject: Re: Simple trick for getting different random numbers in each render
Date: 31 Oct 1999 12:40:04
Message: <an4cOCDHC0LuEiY+YSeAthDZ2l6x@4ax.com>
On 31 Oct 1999 03:10:47 -0500, Nieminen Juha <war### [at] punarastascstutfi>
wrote:

>Btw, who is the F1 champion?-)

  Hey, OT! I haven't seen the Suzuka race, yet, Warp! It's due to be
televised in my area, tape-delayed, in about 20 minutes. Someone may answer
your question so I can't read this thread any further <s>.

-- 
Alan - ako### [at] povrayorg - a k o n g <at> p o v r a y <dot> o r g
http://www.povray.org - Home of the Persistence of Vision Ray Tracer


Post a reply to this message

From: Nieminen Juha
Subject: Re: Simple trick for getting different random numbers in each render
Date: 1 Nov 1999 03:57:38
Message: <381d5602@news.povray.org>
Alan Kong <ako### [at] povrayno-spamorg> wrote:
:   Hey, OT! I haven't seen the Suzuka race, yet, Warp! It's due to be
: televised in my area, tape-delayed, in about 20 minutes.

  Sorry. I didn't realize that this kind of thing would happen :/

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Nieminen Juha
Subject: Re: Simple trick for getting different random numbers in each render
Date: 1 Nov 1999 04:02:29
Message: <381d5725@news.povray.org>
Actually you are right. It could be done better this way:

#macro Randomize()
  #if(file_exists("seed.dat"))
    #fopen ifile "seed.dat" read
    #read(ifile,R)
    #fclose ifile
  #else
    #local R=0;
  #end
  #declare Seed=seed(R);
  #fopen ofile "seed.dat" write
  #write(ofile,R+1)
  #fclose ofile
#end

  To use it, call it at the beginning of the file:

Randomize()

and the use rand(Seed) where needed.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Alan Kong
Subject: Re: Simple trick for getting different random numbers in each render
Date: 2 Nov 1999 04:22:49
Message: <=qweOPaxYroqa3Se1XLBJRugWi3q@4ax.com>
On 1 Nov 1999 03:57:38 -0500, Nieminen Juha <war### [at] punarastascstutfi>
wrote:

>Sorry. I didn't realize that this kind of thing would happen :/

  Just semi-kidding <s>. I didn't read the thread any further until after I
saw the race.

-- 
Alan - ako### [at] povrayorg - a k o n g <at> p o v r a y <dot> o r g
http://www.povray.org - Home of the Persistence of Vision Ray Tracer


Post a reply to this message

From: Chris Huff
Subject: Re: Simple trick for getting different random numbers in each render
Date: 2 Nov 1999 05:23:46
Message: <381EBC4D.DE21BBF3@yahoo.com>
Just one question: Why do you want different numbers each session? It
would just make debugging harder...


Post a reply to this message

From: Nieminen Juha
Subject: Re: Simple trick for getting different random numbers in each render
Date: 2 Nov 1999 05:32:46
Message: <381ebdce@news.povray.org>
Chris Huff <chr### [at] yahoocom> wrote:
: Just one question: Why do you want different numbers each session? It
: would just make debugging harder...

  I didn't say that _I_ want different numbers in each render. However, there
are many people who want. Ask them :)
  There are some situations where "real" random numbers are useful (instead
of having the same series on number each time).

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Ken
Subject: Re: Simple trick for getting different random numbers in each render
Date: 2 Nov 1999 05:49:46
Message: <381EC0D8.57DB3E7E@pacbell.net>
Nieminen Juha wrote:
> 
> Chris Huff <chr### [at] yahoocom> wrote:
> : Just one question: Why do you want different numbers each session? It
> : would just make debugging harder...
> 
>   I didn't say that _I_ want different numbers in each render. However, there
> are many people who want. Ask them :)
>   There are some situations where "real" random numbers are useful (instead
> of having the same series on number each time).

 One example would be a web page that offers a render on line example of
how povray works. With a truly random number there would be no reason to
ask the visitor to supply a seed amount since it would be automated and
each time it was activated the visitor would see a completely different
example.

-- 
Ken Tyler -  1100+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

From: Chris Huff
Subject: Re: Simple trick for getting different random numbers in each render
Date: 2 Nov 1999 05:50:28
Message: <381EC28E.D413C619@yahoo.com>
The only situation I can think of is where you want a bunch of different
versions of an object. In that case I simply seed the stream with a
large number multiplied by clock.

#declare globalRandStream = seed(50000*clock);

Then I just make an animation of it, and pick out the good versions.

Not saying this is better or anything, just the way I do it.


Post a reply to this message

From: Margus Ramst
Subject: Re: Simple trick for getting different random numbers in each render
Date: 2 Nov 1999 15:08:52
Message: <381F4457.F044D0CA@peak.edu.ee>
I see a potential problem here. Consecutive seeds can give numbers that are
markedly non-random. For example, make a loop to generate a string of spheres,
whose y position is a random number whose seed changes linealrly:

#declare C=0;
#while(C<100)
  #declare S=seed(C);
  #declare R=rand(S);
  sphere{<C,R,0>,1}
  #declare C=C+1;
#end

Chris Huff wrote:
> 
> The only situation I can think of is where you want a bunch of different
> versions of an object. In that case I simply seed the stream with a
> large number multiplied by clock.
> 
> #declare globalRandStream = seed(50000*clock);
> 
> Then I just make an animation of it, and pick out the good versions.
> 
> Not saying this is better or anything, just the way I do it.


Post a reply to this message

From: Chris Huff
Subject: Re: Simple trick for getting different random numbers in each render
Date: 2 Nov 1999 15:59:51
Message: <381F5163.E1DB8D0B@yahoo.com>
A good reason to use a really big number for the multiplier, isn't it?
But yes, you are right, that could possibly become a problem.


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 1 Messages >>>

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