Severi Salminen wrote:
> I also tried that:
>
>
> do{
> x = (double) 2.0*rand()/RAND_MAX -1.0;
> z = (double) 2.0*rand()/RAND_MAX-1.0;
> }
> while(x*x+z*z > 1.0);
>
> y = sqrt(1.0-(x*x+z*z));
>
> And the results are very close to the 2 other methods.
And this is also the fastest algorithm of the tree.
Post a reply to this message
|