import random


def roll(quantity, diceVal):
    """Accepts two values.  First value is an int representing the number 
    of dice being rolled, the second is an int representing the number 
    of sides these dice have. 
    Returns a list containing each roll result as an individual value.
    An empty list indicates an error."""
    rolls = []
    try:
        numRolls = int(quantity)
        numSides = int(diceVal)
        if numRolls <= 0:
            rolls.append(0)
        elif numSides <= 0:
            for die in range(numRolls):
                rolls.append(0)
        else:
            for die in range(numRolls):
                rolls.append(random.randint(1, numSides))
        return rolls
    except:
        return rolls