I want to create a matrix of 0 and 1, using Numpy package, alternating 0 and 1, of size 8*8 This means: Along each row, the values alternate between 0 and 1. Along each column, the values also alternate between 0 and 1. I want something like this: np.random.binomial(n=1, p=0.5, size=[64]) #This is the resulta expected but the code doesn't sort the matrix this way [[0 1 0 1 0 1 0 1] [1 0 1 0 1 0 1 0] [0 1 0 1 0 1 0 1] [1 0 1 0 1 0 1 0] [0 1 0 1 0 1 0 1] [1 0 1 0 1 0 1 0] [0 1 0 1 0 1 0 1] [1 0 1 0 1 0 1 0]] #WHAT I DON'T WANT BUT IT IS QUITE SIMILAR [[1 1 0 1 1 1 0 1] [0 0 1 0 1 0 1 0] [0 0 0 1 0 1 0 1] [0 0 1 0 1 0 1 0] [0 1 0 1 0 1 0 1] [0 0 1 0 1 0 1 0] [0 1 0 1 0 1 0 1] [1 0 1 0 1 0 1 0]] The thing is this is balanced, but the result is not 0 and 1, in an alternative way. Continue reading...