|
![](/i/fill.gif) |
In article <01bfecde$da635120$1a1ba1d0@mk>, "CreeD" <meshe@nqi.net>
wrote:
> I get semi random effects, but I can't figure out what the range of
> possible random numbers I'm outputting will be (I'm using it in a
> color_map statement).
>
> Is the random number going to be between 1 and 123? That seems
> unlikely from the results I get. Is it 1, 2, or 3, or any value in
> between? Am I completely off base? Can I specify a range? , i.e. I
> want -
>
> color rgb <random something between 1 and 5, 5, 5>
Did you look in the manual?
pov.doc Section 4.1 Language Basics
4.1.3 Float Expressions
4.1.3.6 Float Functions
"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."
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
> 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)
--
Christopher James Huff - Personal e-mail: chr### [at] mac com
TAG(Technical Assistance Group) e-mail: chr### [at] tag povray org
Personal Web page: http://homepage.mac.com/chrishuff/
TAG Web page: http://tag.povray.org/
Post a reply to this message
|
![](/i/fill.gif) |