This is the mail archive of the
gsl-discuss@sourceware.org
mailing list for the GSL project.
Re: circular random number distribution
Hi,
On Tue, 09 Aug 2005 12:33:23 +0200
Jochen Küpper <jochen@fhi-berlin.mpg.de> wrote:
> "Robert G. Brown" <rgb@phy.duke.edu> writes:
>
> > In fact, your sqrt call is redundant
>
> Well, that's the deal: It isn't!
>
> Without the sqrt, the functions are peaked at the center. With the
> sqrt they are uniform.
I think, he meant the sqrt in
,----
| do {
| x = gsl_ran_flat(rng, -1, 1);
| y = gsl_ran_flat(rng, -1, 1);
| } while(sqrt(x*x + y*y) > 1.);
`----
Heiko
--
-- Die meisten Meinungen kommen zustande, indem man vergißt, wo man sie
-- gehört oder gelesen hat.
-- (Moritz Heimann, dt. Schriftsteller, 1868-1925)
-- Heiko Bauke @ http://www.uni-magdeburg.de/bauke