|
|
The following macro gives an uniform distribution within the sphere{0,1}
and is slightly faster (by 9%) than VRand_In_Sphere() from rand.inc:
#macro VRand_In_Sphere(Stream)
#local Y = 2*rand(Stream)-1;
vrotate ( (<sqrt(1-Y*Y),Y,0>*pow(rand(Stream),1/3)), 360*rand(Stream)*y )
#end
And this macro gives an uniform distribution on the surface of the
sphere{0,1}. It's slightly faster than VRand_On_Sphere() from rand.inc:
#macro VRand_On_Sphere(Stream)
#local Y = 2*rand(Stream)-1;
vrotate ( <sqrt(1-Y*Y), Y, 0>, 360*rand(Stream)*y )
#end
I suggest to replace the original rand.inc macros by these macros.
Sputnik
Post a reply to this message
|
|