import colorsys
from random import random


def gen_colors(n, norand=False):
    """
    Produce n evenly distributed colors using the HSV colour pickle and the
    golden ratio value of ~0.6 to separate the colours. By default the initial
    colour selected is random.
    """

    
    golden_ratio = 0.618033988749895
    if norand: h = 0.22717784590367374
    else:      h = random() 
    ll = []
    for x in range(0, n):
        h += golden_ratio
        h %= 1
        HSV_tuple = [h, 0.95, 0.95]  # this defines how "deep" are the colors
        RGB_tuple = colorsys.hsv_to_rgb(*HSV_tuple)
        ll.append([str(int(x*256)) for x in RGB_tuple])
    return ll