def get_random_coo_matrix(rows=3,cols=10,nnz=20):
    row_col = random.sample(xrange(rows*cols),nnz)  # ensure <row,col> are unique
    row = [i // cols for i in row_col]
    col = [cols % i for i in row_col]
    data = np.random.randint(0,nnz*5,nnz)
    return coo_matrix((data,(row,col)),shape=(rows,cols))
dataset/ETHPy150Open Mendeley/mrec/mrec/testing.py/get_random_coo_matrix/swapped operands of `%`