
Re: How to make weighted random numbers?
Posted:
Feb 27, 2009 10:18 PM


On Feb 28, 2:36 am, Rich Grise <r...@example.net> wrote: > Say, I want to fill a sphere uniformly with random dots; the logical way > to do that in r,theta format; otherwise to make a sphere, you'd have to > do some heroic math on the three dimension (or is there some > quickndirty formula that can do it in one flop, that they don't tell > us high school (and Tech School, don't forget!) ? > > Either way. I don't want a uniform sphere  more like density through the > center looks like a bellshaped curve, i.e., denser in the middle?
You can choose the distance from the dot to the centre, r, according to whatever distribution you want (e.g. Gaussian), and then place the dot at a uniformly random point on the surface of a sphere of radius r, chosen using a method such as the one given at http://mathworld.wolfram.com/SpherePointPicking.html

