title: Numpy: split array randomly
body: <p>I have a numpy array of shape holding many (200 in this example) monochromatic 64x64 pixel images, thus having the shape:</p>
  
  <pre><code>&gt;&gt;&gt; a.shape
  (200L, 1L, 64L, 64L)
  </code></pre>
  
  <p>I want to split these images in 3 new arrays, <code>a1</code>, <code>a2</code>, <code>a3</code> where they will contain 80%, 10%, 10% of the images respectively, and I am doing it in the following way (I do not want them to be consecutive in <code>a</code>):</p>
  
  <pre><code>import numpy as np
  import random
  
  a = --read images from file--
  
  a1 = numpy.empty((0,1,64,64))
  a2 = numpy.empty((0,1,64,64))
  a3 = numpy.empty((0,1,64,64))
  
  for i in range(200): #200 is the number of images
      temp = a[-1]
      a = np.delete(a,-1,0)
      rand = random.random()
      if rand &lt; 0.8:
          a1 = np.append(a1,[temp],0)
      elsif rand &lt; 0.9:
          a2 = np.append(a2,[temp],0)
      else:
          a3 = np.append(a3,[temp],0)
  </code></pre>
  
  <p>I try to emulate <code>pop</code> and <code>append</code> which are done at <code>O(1)</code> time on lists, but does the same hold for numpy arrays?
  Is there some way to do this more efficiently (faster) for a large number (thousands) of images?</p>