POV-Ray : Newsgroups : povray.advanced-users : Need help with rand/seed : Re: Need help with rand/seed Server Time
26 Nov 2024 13:27:20 EST (-0500)
  Re: Need help with rand/seed  
From: CreeD
Date: 13 Jul 2000 12:29:19
Message: <01bfece8$39e5ea00$1a1ba1d0@mk>
> Did you look in the manual?

yes.

> "rand(I)   Returns the next pseudo-random number from the stream 
> specified by the positive integer I. You must call seed() to initialize 
> a random stream before calling rand(). The numbers are uniformly 
> distributed, and have values between 0.0 and 1.0, inclusively. The 
> numbers generated by separate streams are independent random variables."

ironically, this is in the 'language basics' section.
Did you write it? 
But seriously.  Talk to me like I'm a truck driver.  When it says 'the next
pseudo random number from the stream specified' I'm not sure what a stream
is - a sequence of numbers (1,2,3,4, etc and it picks one of those) or a
set (0-1,234)?
As for uniformly distributed, does that mean the result will be whole or
what?
 
> If you want a range, multiply the results of rand() by the length of the 
> range, then add the minimum value of the range. Like this:
> #macro RRand(RS, Min, Max)
>     (rand(RS)*(Max-Min) + Min)
> #end

That's what I was looking for ..  thanks.  


> > Also, is there a way to make POV get a new, completely random 
> > evaluation of my random number every time it renders, so that I can 
> > keep experimenting until I get something I like?
 
> The usual solution is either to store the seed value in a file, and 
> change it with every render, or to change it manually for every 
> render(not really a lot of work). MegaPOV has time/date functions that 
> can be used to calculate different seed values, to get a different 
> random stream every render. I think there is a MegaPOV demo scene which 
> does this. (truerand.pov)

I'll give that a shot.


Post a reply to this message

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