|
![](/i/fill.gif) |
Hi all,
I asked the same question recently and this is the reply I got from Margus
Ramst which I found very useful:
First you have to declare a random number seed, like this:
#declare RandSeed = seed(N); file://N is a random integer of your choice
The you can call the rand() function, with the name of the seed identifier
as
the parameter, for examle like this:
#declare RandomValue=rand(RandSeed);
Each time you call rand(RandSeed) a different (pseudo)random value is
returned
from the stream initialized by RandSeed.
For creating random numbers of a given mean value and maximum deviation, you
can
try these macros (the first returns a float, the second depends on the first
and
returns a 3D vector):
file://Create random number of given mean and maximum deviation
file://M - mean value
file://D - maximum deviation
file://Seed - (declared) random number seed identifier
#macro rand_ext(M,D,Seed)
(M+(rand(Seed)-.5)*2*D)
#end
file://Give a random vector of given mean and max deviation
file://M - mean (vector or float)
file://D - max deviation (vector or float)
file://Seed - (declared) random number seed identifier
#macro v_rand_ext(M,D,Seed)
#local MV=M+<0,0,0>;
#local DV=D+<0,0,0>;
(<rand_ext(MV.x,DV.x,Seed),
rand_ext(MV.y,DV.y,Seed),
rand_ext(MV.z,DV.z,Seed)>)
#end
Dooby
"Greg M. Johnson" <"gregj;-)56590\""@aol.c;-)om> wrote in message
news:3acbe284@news.povray.org...
> This is the second time someone has asked this recently, and RFTM doesn't
> apply here.
> It is the case that the word "random" in the 3.1 help never brings up the
> actual RAND() function: perhaps this should be changed for the 3.5 help.
>
> Shay wrote:
>
> > I know that povray will do this, but can't find any info in the
> > instructions. Would someone please direct me towards some random number
> > generating instructions?
> >
> > Thank you,
> > Shay
>
Post a reply to this message
|
![](/i/fill.gif) |