POV-Ray : Newsgroups : povray.newusers : rand not producing random! : Re: rand not producing random! Server Time
6 Oct 2024 01:33:49 EDT (-0400)
  Re: rand not producing random!  
From: Kenneth
Date: 9 Jan 2010 15:25:01
Message: <web.4b48e504cc0023fa65f302820@news.povray.org>
"geogeo" <geo### [at] mecolcouk> wrote:
> I am using a rand generated value 'n' but the result is always the same. I've
> put in a text trace to output the value 'n' as follows:
>
> #declare R1 = seed(1);
> #declare n = rand(R1);

I remember that the concept of using seed() and rand() was a bit difficult to
grasp when I started out with POV-Ray (there is no real 'how-to' in the
documentation.)

Here's a simple example:

#declare R1 = seed(27);

pigment{color rgb <rand(R1),rand(R1),rand(R1)>}

Each rand is a different value--but those three different values will always be
the 'same', since they use the same seed() value. Change seed() and you get
three *new* and different rand() values.

Ken


Post a reply to this message

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