import numpy as np
import prairielearn as pl
def generate(data):
nInnerMin = 2
nMax = 5
nRows = np.random.randint(1, nMax + 1)
nInner = np.random.randint(nInnerMin, nMax + 1)
nCols = np.random.randint(1, nMax + 1)
nDigits = 1
numMax = 10
Are = np.random.random_integers(-numMax, numMax, (nRows, nInner)) / (10**nDigits)
Aim = np.random.random_integers(-numMax, numMax, (nRows, nInner)) / (10**nDigits)
Bre = np.random.random_integers(-numMax, numMax, (nInner, nCols)) / (10**nDigits)
Bim = np.random.random_integers(-numMax, numMax, (nInner, nCols)) / (10**nDigits)
A = Are + Aim * 1j
B = Bre + Bim * 1j
C = A.dot(B)
data["params"]["A"] = pl.to_json(A)
data["params"]["B"] = pl.to_json(B)
data["correct_answers"]["C"] = pl.to_json(C)