NUMPY create, fill with random binary data

arrays, numpy, python

Solution

Generate a random matrix with binary values:

import numpy as np
row, col = 10, 5
matrix = np.random.randint(2, size=(row,col))

Problem

I need to create an 2D array. ``` import numpy as np self.col = 10 self.row = 5 ... matrix = np.array(self.row, self.col) # NOT WORKING ``` What is the right syntax please i also need to fill it with random binary data

Original source