import random


def generateDistribution(maxLength, totalCount, numDice, randomness):
    """
    Returns a bell curve distribution.

    maxLength controls how wide your x-axis will be.
    totalCount is the total number of points you want to generate.
    numDice is the number of random numbers you want to add together to create 
        one length. The more dice you roll, the steeper you curve will be.
    randomness is a number between 0 and 100 that represents a percentage chance
        that a number is randomly dropped from the number creation. This is
        useful for shifting a data set to the left and gives a better 
        horizontal asymptote.
    """
    lengthList = list()
    for i in range(totalCount):
        # Generate numbers
        num = 0
        for d in range(numDice):
            # Pass randomness test
            randomizer = random.randint(1,100)
            if (randomness < randomizer):
                # Add random number in range to total
                num += random.randint(0,(maxLength//numDice))
        if(num >= maxLength):
            #print(num)
            num = maxLength - 1
        lengthList.append(num)

    countList = list(0 for i in range(maxLength))
    for l in lengthList:
        countList[l] += 1

    return countList, lengthList