*Generate random supernova types from the weighted distributions set in the simulation settings file*

    **Key Arguments:**
        - ``log`` -- logger
        - ``sampleNumber`` -- the sample number, i.e. array size
        - ``relativeSNRates`` -- dictionary of the rates
        - ``pathToOutputPlotDirectory`` -- path to the output directory (provided by the user)
        - ``plot`` -- generate plot?

    **Return:**
        - ``snTypesArray`` -- numpy array of the random SN types

def random_sn_types_array(
        log,
        sampleNumber,
        relativeSNRates,
        pathToOutputPlotDirectory,
        plot=False):
    """
    *Generate random supernova types from the weighted distributions set in the simulation settings file*

    **Key Arguments:**
        - ``log`` -- logger
        - ``sampleNumber`` -- the sample number, i.e. array size
        - ``relativeSNRates`` -- dictionary of the rates
        - ``pathToOutputPlotDirectory`` -- path to the output directory (provided by the user)
        - ``plot`` -- generate plot?

    **Return:**
        - ``snTypesArray`` -- numpy array of the random SN types
    """
    ################ > IMPORTS ################
    ## STANDARD LIB ##
    ## THIRD PARTY ##
    ## LOCAL APPLICATION ##
    import numpy as np
    import matplotlib.pyplot as plt

    ################ > VARIABLE SETTINGS ######

    ################ >ACTION(S) ################
    randomSNTypeList = []
    # CREATE COUNTERS FOR PLOTTING
    counters = {}
    for k, v in relativeSNRates.iteritems():
        counters[k] = 0

    for i in range(sampleNumber):
        randNum = np.random.rand()
        cumulative = 0.
        for k, v in relativeSNRates.iteritems():
            cumulative = cumulative + v
            if (randNum <= cumulative):
                randType = k
                counters[k] += 1
                break
        randomSNTypeList.append(randType)

    # for k, v in relativeSNRates.iteritems():
    #     log.debug('%s = %s' % (k, counters[k]))

    snTypeArray = np.array(randomSNTypeList)

    if plot:
        numTypes = len(relativeSNRates)
        x = np.arange(1, numTypes + 1, 1)

        heights = []
        xticks = []
        for k, v in relativeSNRates.iteritems():
            xticks.append(k)
            heights.append(counters[k])

        fig = plt.figure(
            num=None,
            figsize=(8, 8),
            dpi=None,
            facecolor=None,
            edgecolor=None,
            frameon=True)

        ax = fig.add_axes(
            [0.1, 0.1, 0.8, 0.8])

        ax.bar(
            x,
            heights,
            width=0.8,
            bottom=0)

        plt.xticks(x + 0.5,  xticks)

        ax.set_xlabel('SN Type')
        ax.set_ylabel('Number of SNe')
        ax.grid(True)

        title = "Weighted SN Distribution"
        plt.title(title)
        fileName = pathToOutputPlotDirectory + title.replace(" ", "_") + ".png"
        plt.savefig(fileName)
        plt.clf()  # clear figure

    return snTypeArray