POV-Ray : Newsgroups : povray.newusers : Using rand(); clear howto! : Using rand(); clear howto! Server Time
5 Sep 2024 08:15:25 EDT (-0400)
  Using rand(); clear howto!  
From: Simon Lemieux
Date: 10 May 2001 22:33:15
Message: <3AFB17FE.C5519168@yahoo.com>
I'm currently trying to use rand to determine random location of objects in my
scene.  I would like rand to give the exact same result every time it runs.

I've been programming with povray for about more than a year now and I've made
some very nice stuff, whenever I needed random calculation or heavy math
algorythms, I would move to C++ and build a program that would output a
file.pov...

I don't want to do that anymore, I would like to use pov and pov only, I believe
there is a very common way to get a good random!

Here is an example of code that should normally give a cloud of dots, brighter
if there is more objects with antialiasing:

#declare n = 100 *2;
#declare i = 0;
#declare b = 3;
#while (i<n)

sphere { <rand(seed(i)), rand(seed(i+1)), 0>, 0.01 pigment { color rgb 1 }
finish { ambient 1 } translate <-0.5, -0.5, 0> scale 2}

#declare i = i+2;
#end

But this code give two Very well aligned lines (made of dots...), what is the
problem?

Thanks,
  Simon

-- 
+--------------------------------+---------------------------+
| Simon Lemieux                  | http://666Mhz.myip.org/   |
| Email : lem### [at] yahoocom | Povray and OpenGL Gallery |
+--------------------------------+---------------------------+


Post a reply to this message

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