   random distribution of points on a sphere [SOLVED]
  for my sky i use a unit sphere ( math shows that radius doesn't matter as it is 'projected' away anyways ). this sphere i want to populate with a bunch of stars, let's say 10k of them. i specify their position on the sphere using a view/up vector pair ( whereas up is not important as stars have rotation symmetry ). i use the following to start with:elevation = ( Engine.random() - 0.5 ) * 2mat = Matrix.newRotation( elevation * 180, Engine.random() * 360, 0 )body.setView( mat.getViewVector() )body.setUp( mat.getUpVector() )Engine.random() simply yields a random number in the range [0-1] inclusive. hence i simply determine a random elevation and azimute for the star. as expected the stars clobber a lot at the zenit and at the equator there are only a few ( due to the nature of a sphere ). now i tried to come up with a simple method to get a rather uniform distribution of the stars around that sphere with the clobbering. i tried Math.sin and Math.pow to make it less likely a star ends up near the zenit than at other places. but in both cases i ended up with a noticed 'ring' of stars at the equator, nearly no stars in the middle ( around 45° elevation ) and still a huge bunch of stars at the zenit.any ideas how i can pull of this distribution?EDIT: the one and only thing that really annoys me on this forum is the code-tag... it never works when i do it >.=.<[Edited by - RPTD on June 1, 2006 3:09:19 PM]
Winslow Homer;  In Gamedev, you use source instead of code tags, and C++ is defualted to.   ;mathworld says;  the one of sneftel did the job. thx :D   