POV-Ray : Newsgroups : povray.advanced-users : Random variation : Re: Random variation Server Time
29 Jul 2024 08:10:08 EDT (-0400)
  Re: Random variation  
From: hughes, b 
Date: 26 Sep 2002 10:41:45
Message: <3d931ca9$1@news.povray.org>
You can, of course, test against equality if you wanted to prevent that.
Simply by doing #if (J!=K) /* do whatever */ #end

I don't know the exact method used for a random number in POV without trying
to look it up but I'd guess its precision is the same as for any of the
math, meaning it is probably random down to the same decimal levels of other
numbers.

Just checked here using (no camera of light needed):

#declare S=seed(1234);
#declare R=rand(S);
#text {ttf "times.ttf",str(R,0,18),0.1,0
translate <-5,-0.25,10>
pigment {rgb 9}}

And this seems to get to 17 decimal places, rest are zeroes. If you use the
system specific way, -1 instead of 18 in the str(), you'll probably see it
to only 6 decimals. So it depends a lot on how you use it. 17 decimal places
leaves very little room for chance of getting two identical random numbers,
if it does indeed remain randomized over time.

This isn't the same reasoning for the seed(), it allows for the same
generation of a sequence of random numbers or else you wouldn't get
identical scenes each render.

--
Farewell,
Bob

"Andrew Coppin" <orp### [at] btinternetcom> wrote in message
news:3d93103a@news.povray.org...
>
> #declare A = seed(...);
> #declare J = rand(A);
> #declare K = rand(A);
>
> POV-Ray's rand() function returns random numbers in the (closed?)
> invertal 0..1. But what is the minimum difference between J and K?
> Presumably if you're really fluky they might just happen to have the
> exact same value (improbable but not impossible). Assuming this is
> not the case, what is the smallest amount they can differ by?


Post a reply to this message

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