The golden ratio method looks neat; but I think it can be forked into two algorithms. In the site version, they know ahead of time how many colors are needed. If you need n colors, you could use the multiplicative inverse mod n to pick angles along the color wheel. This results in every color being unique and as far away as the other colors as possible.
In the case you don't know how many colors you will need at the time of first picking you can use the golden ratio method to pick colors.