Difference between revisions of "Documentation Talk:Reference Section 2"

From POV-Wiki
Jump to navigation Jump to search
m (follow up)
Line 44: Line 44:
 
Considering that #macro is different from a function and clicking on the function
 
Considering that #macro is different from a function and clicking on the function
 
keyword in the overview bring you here.[[User:Froesccn|Froesccn]] 22:42, 31 August 2010 (UTC)
 
keyword in the overview bring you here.[[User:Froesccn|Froesccn]] 22:42, 31 August 2010 (UTC)
 +
 +
:* done --[[User:Jholsenback|jholsenback]] 11:01, 1 September 2010 (UTC)

Revision as of 11:01, 1 September 2010

rand(I) Returns the next pseudo-random number from the stream specified by the positive integer I. You must call seed() to initialize a random stream before calling rand(). The numbers are uniformly distributed, and have values between 0.0 and 1.0, inclusively. The numbers generated by separate streams are independent random variables.

seed(I) Initializes a new pseudo-random stream with the initial seed value A. The number corresponding to this random stream is returned. Any number of pseudo-random streams may be used as shown in the example below:

#declare R1 = seed(0);
#declare R2 = seed(12345);
sphere { <rand(R1), rand(R1), rand(R1)>, rand(R2) }

Multiple random generators are very useful in situations where you use rand() to place a group of objects, and then decide to use rand() in another location earlier in the file to set some colors or place another group of objects. Without separate rand() streams, all of your objects would move when you added more calls to rand(). This is very annoying.

I think the text
In addition to the above built-in functions, you may also define your own functions using the #macro directive. See the section "User Defined Macros" for more details.
should be changed to
In addition to the above built-in functions, you may also define your own functions using the function keyword. See the section "User Defined Functions" for more details.
Considering that #macro is different from a function and clicking on the function keyword in the overview bring you here.Froesccn 22:42, 31 August 2010 (UTC)