Assume an input of an array of random binary digits.
Invoke a genetic algorithm upon it including the processes of crossing over and mutation, using a fitness function (preferably Shannon entropy) to select elements to be preferred in the next generation. Libraries such as pygad (https://pypi.org/project/pygad/) may be used for this purpose.
A certain number of generations should be implemented, the output of which should be in the same form as the initial input.