I am trying to generate sequences containing only `0`

‘s and `1`

‘s. I have written the following code, and it works.

```
import numpy as np
batch = 1000
dim = 32
while 1:
is_same = False
seq = np.random.randint(0, 2, (batch, dim))
for i in range(batch):
for j in range(i + 1, batch):
if np.array_equal(seq(i), seq(j)):
is_same = True
if is_same:
continue
else:
break
```

My `batch`

variable is in the thousands. This loop above takes about 30 seconds to complete. This is a data generation part of another `for`

loop that runs for about 500 iterations and is therefore extremely slow. Is there a faster way to generate this list of sequences without repetition? Thanks.

The desired result is a collection of `batch_size`

number of sequences each of length `dim`

containing only `0`

s and `1`

s such that no two sequences in the collection are the same.