POV-Ray : Newsgroups : povray.windows : Random Numbers Server Time
28 Jun 2024 22:45:39 EDT (-0400)
  Random Numbers (Message 1 to 4 of 4)  
From: Jeremy Kruger
Subject: Random Numbers
Date: 7 May 2003 22:18:18
Message: <3EB9BEFC.C7654D48@shaw.ca>
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.


Post a reply to this message

From: Ken
Subject: Re: Random Numbers
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

From: Ken
Subject: Re: Random Numbers
Date: 7 May 2003 22:44:01
Message: <3EB9C45F.E9B45CA8@pacbell.net>
P.S. For a good loop tutorial check out -
http://www.f-lohmueller.de/pov_tut/loop/povlup1e.htm

-- 
Ken Tyler


Post a reply to this message

From: Jeremy Kruger
Subject: Re: Random Numbers
Date: 9 May 2003 00:02:19
Message: <3EBB28DD.87CF19A1@shaw.ca>
Ken wrote:
> 
> P.S. For a good loop tutorial check out -
> http://www.f-lohmueller.de/pov_tut/loop/povlup1e.htm
> 
> --
> Ken Tyler

Hey, thanks a lot!


Post a reply to this message

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