Distributing Points on the Sphere discusses four different approaches. For some readready-madeto-use code (with a demo, see below), you can use the Fibonacci algorithm. (Click on the $</>$ sign at the top of that page to see the code.)
demo by Jim BumgardnerFibonacci algorithm: A fast method of producing an arbitrary number of equally distributed points around a sphere. This is accomplished by drawing a fibonacci spiral (similar to sunflower seed pattern) that maintains constant surface area.