Hi,
Does anyone know who I can generate random numbers for a loop. I'm
creating a landscape for grass, I'm using the same bunch of grass each
time it goes through the loop and I want to give it a random size every
time.
Any help is appreciated.
Thanks.
Jeremy Kruger wrote:
> > Hi,> > Does anyone know who I can generate random numbers for a loop. I'm> creating a landscape for grass, I'm using the same bunch of grass each> time it goes through the loop and I want to give it a random size every> time.
You need to use the rand() and seed() commands for that. An example of
it's usage below. Add you own translate numbers. Changing the seed(1234)
number will change the beginning location in the random number stream
resulting in different results. Rand() will always return a value between
zero and one.
#declare SEED = seed(1234);
#declare A=0;
#while (A<10)
object { Grass_Patch
translate <whatever>
scale < rand(SEED), rand(SEED), rand(SEED)>
}
#declare A=A+1;
#end
--
Ken Tyler