For some ready-to-use code (with a demo, see below), you can use the <A HREF="https://www.openprocessing.org/sketch/41142">Fibonacci algorithm</A>. (Click on the $</>$ sign at the top of that page to see the code.)

<IMG SRC="https://ilorentz.org/beenakker/MO/sketch41142.gif" WIDTH="400"/>
<sub>demo by Jim Bumgardner </sub>

*Fibonacci 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.