title: Making n unique l long 0-1 series in Python
body: <p>I would like to make n random l long 0-1 series, so that all of them are different. I tried to make them with while loop, but it is quite inefficent. I am wondering if there is a better way to do it. (I wrote a separate function which gives back 1 l long 0-1 series and I used it in my other function.)</p>
  <pre class="lang-py prettyprint-override"><code>import numpy as np
  alph=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', ' ', '!', ',', '-', '.', ':', '?', ';','0','1','2','3','4','5','6','7','8','9']
  class Error(Exception): 
      def __init__(self, text , data):
          self.text = text 
          self.data = data
          
      def __str__(self):
          return str(self.text)+str(self.data)
  def key_gen(l):
      a = np.random.randint(2, size=(l))
      return ''.join([str(i) for i in a])
  def dict_gen(k):
      if 2**k &lt; len(alph):
          raise Error(&quot;There is not enough 0/1 series, can not assign different series to different letters, k is too small:&quot;, k)
      else:
          letter={}
          for i in alph:
              for j in alph:
                  letter[i]=key_gen(k)
                  while key[i]==key[j]:
                      letter[i]=key_gen(k)
        
          return letter
  
  </code></pre>
  <p>For example 3 long 1-0 series: 010, 100, 111....
  I would like to a make a dictionary like this, without the while loop I sometimes I get same values to different keys. I would be grateful if you could help me correct my code.</p>