def freivalds(A, B, C):
    """Tests matrix product AB=C by Freivalds

    :param A: n by n numerical matrix
    :param B: same
    :param C: same
    :returns: False with high probability if AB != C

    :complexity:
        :math:`O(n^2)`
    """
    n = len(A)
    x = [randint(0, 1000000) for j in range(n)]
    return mult(A, mult(B, x)) == mult(C, x)