POV-Ray : Newsgroups : povray.windows : Random Numbers : Re: Random Numbers Server Time
1 Jul 2024 01:43:07 EDT (-0400)
  Re: Random Numbers  
From: Ken
Date: 7 May 2003 22:41:43
Message: <3EB9C3D4.EF10969E@pacbell.net>
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


Post a reply to this message

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