def rslice(n, allow_empty=False):
 minlen = (0 if (allow_empty or (n == 0)) else 1)
 slicelen = randrange(minlen, (n + 1))
 return randslice_from_slicelen(slicelen, n)

def rslice ( n , allow_empty = False ) : minlen = ( 0 if ( allow_empty or ( n == 0 ) ) else 1 ) slicelen = randrange ( minlen , ( n + 1 ) ) return randslice_from_slicelen ( slicelen , n )
generate random slice for a single dimension of length n .