I want to generate random strings (or arrays) of 1's and 0's. Then I classify them according to quantity (count) of 1's. I want the generated strings to be evenly distributed among the possible counts.
But the following code gives me a normal distribution:
import numpy as np
for i in range(num_examples):
seq = np.random.randint(2, size=(seq_length)).astype('float32')
sequences[i] = seq
target_classes = []
for input in sequences:
target = (input == 1).sum()
target_classes.append(target)
The histogram of counts is:
A NumPy solution would be awesome. Or do I need regular expressions or something else?

