espressomd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ESPResSo] bug in random.tcl in mbtools


From: duenweg
Subject: Re: [ESPResSo] bug in random.tcl in mbtools
Date: Thu, 19 Mar 2009 09:40:28 +0100 (CET)
User-agent: SquirrelMail/1.4.16

Hello,

from Tristan's remarks I understand that there
is a question of how to get random numbers
uniformly in or on a sphere? If so, let me tell
you one possible answer:

1. You first draw 3 RNs u_1, u_2, u_3 from [0:1]
2. Then you transform u_1 = 2 * u_1 - 1 etc.,
   resulting in RNs in [-1,1]
3. Calculate r2 = u_1**2 + u_2**2 + u_3**2
4. If r2 > 1 --> throw everything away,
   go to step 1, try again
5. If r2 < 1: Either you are done (supposing
   that you want RN IN the sphere), or you set
   norm = 1 / sqrt(r2)
   u_1 = u_1 * norm etc.
   By this you project the output onto the
   surface of the unit sphere, so you get
   something ON the sphere.

If that was trivial: Please accept my apologies
for bothering you.

Regards
Burkhard.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]