def _permute_observations(x, y, num_perms):
 vals = hstack([array(x), array(y)])
 lenx = len(x)
 vals.sort()
 inds = arange(vals.size)
 (xs, ys) = ([], [])
 for i in range(num_perms):
  shuffle(inds)
  xs.append(vals[inds[:lenx]])
  ys.append(vals[inds[lenx:]])
 return (xs, ys)

def _permute_observations ( x , y , num_perms ) : vals = hstack ( [ array ( x ) , array ( y ) ] ) lenx = len ( x ) vals . sort ( ) inds = arange ( vals . size ) ( xs , ys ) = ( [ ] , [ ] ) for i in range ( num_perms ) : shuffle ( inds ) xs . append ( vals [ inds [ : lenx ] ] ) ys . append ( vals [ inds [ lenx : ] ] ) return ( xs , ys )
return num_perms pairs of permuted vectors x .