|
 |
I forget where I found this, but I've had it awhile.
#macro rand_ext(M,D,Seed)
(M+(rand(Seed)-.5)*2*D)
#end
This macro returns a random number in a range where M is the mean value, D
is the negative and positive deviation from this mean, and Seed is a
seed([number]) value.
For instance, the line #declare fromfivetofifteen=rand_ext(10,5,seed(123));
would return a random value between 5 and 15.
-Chris-
Thomas Lake <tla### [at] home com> wrote in message
news:3afdcb2e$1@news.povray.org...
> In my previous post I talked about adding random translation/rotation into
> my tunnel building script. I've played around with the rand() function
with
> mixed results. From what I understand it works like so
>
> #declare myseed = seed(12);
>
> translate <0,0,rand(myseed)>
>
> The problem with this is that the random value you get is only between 0
and
> 1. SO I tried the following.
>
> translate <0,0,rand(myseed)/rand(myseed)> or
> translate <0,0,rand(myseed)/rand(myseed)*rand(myseed)>
>
> This does work better but I still don't get the effect I want. With this
> method most of the objects are still only translated an imperceptible
> amount, and then every once in a while an object will be translated a
large
> distance. What I want is for all the objects to be noticeably translated a
> random amount, but I don't want any sudden leaps.
>
>
Post a reply to this message
|
 |