- Home /

# How to create a list of all possible binary permutations with a given number zeros?

How to create a list of all possible binary permutations with a given length(4-8) and a given number of zeros? (I need to create lists with up to 8 digit sequences and without duplicates).

For example:

x = 2 (the number of zeros in the binary sequence)

l = 4 (length of the binary sequence)

The list: 0011 0101 0110 1001 1010 1100

I don't really know where to start. Any help would be appreciated.

You should start by looking into the algorithm to generate the permutations, then you worry about how to feed it the correct data so you get the output you want.

Here are a couple of links I found doing a quick google search:

https://stackoverflow.com/questions/15150147/all-permutations-of-a-list

https://stackoverflow.com/questions/104420/how-to-generate-all-permutations-of-a-list-in-python

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.