import random


def random_matrices(n, m, p):
    """Generates two matrices which can be multiplied together,
    containing random real numbers.
    """
    A = [[random.random() for _ in range(m)] for _ in range(n)]
    B = [[random.random() for _ in range(p)] for _ in range(m)]
    return A, B