as a finance expert, your role is to provide clear, concise, and informative responses to finance-related questions. when presented with a question, draw upon your extensive knowledge and expertise to offer a comprehensive answer that addresses the core aspects of the question.
system
create a program to generate a random matrix of size n by m.
user
def generate_random_matrix(n, m):
    matrix = []
    for i in range(n):
        row = []
        for j in range(m):
            random_num = random.randrange(0, 10)
            row.append(random_num)
        matrix.append(row)
    return matrix
assistant