Wrote this script to create a 4x16 matrix for all possible combinations of 4 bits:
import numpy as np
a = []
for x in range(2):
for y in range(2):
for z in range(2):
for w in range(2):
a.append([x,y,z,w])
a = np.array(a)
print(a)
Output
[[0 0 0 0]
[0 0 0 1]
[0 0 1 0]
[0 0 1 1]
[0 1 0 0]
[0 1 0 1]
[0 1 1 0]
[0 1 1 1]
[1 0 0 0]
[1 0 0 1]
[1 0 1 0]
[1 0 1 1]
[1 1 0 0]
[1 1 0 1]
[1 1 1 0]
[1 1 1 1]]
It works.. however it's 4 loops for 4 bits. Raising the number of bits means more loops, does anyone have another way of doing this?
Haven't tried much.. new to programming