def _generate_pl_dataset(n, m, outfile, useDirichlet):
    """
    Description:
        Generate a Plackett-Luce dataset and
        save it to disk.
    Parameters:
        n:            number of votes to generate
        m:            number of alternatives
        outfile:      open file object to which the dataset is written
        useDirichlet: boolean flag to use the Dirichlet distribution
    """

    gamma, votes = generate_pl_dataset(n, m, useDirichlet)
    outfile.write(str(len(gamma)) + ',' + str(len(votes)) + '\n')
    outfile.write(','.join(map(str, gamma)) + '\n')
    for vote in votes:
        outfile.write(','.join(map(str, vote)) + '\n')
    return (gamma, votes)