Generate random slice for a single dimension of length n. If zero=True, the slices may be empty, otherwise they will be non-empty.
(n, allow_empty=False)
| 709 | return product(*iterables) |
| 710 | |
| 711 | def rslice(n, allow_empty=False): |
| 712 | """Generate random slice for a single dimension of length n. |
| 713 | If zero=True, the slices may be empty, otherwise they will |
| 714 | be non-empty.""" |
| 715 | minlen = 0 if allow_empty or n == 0 else 1 |
| 716 | slicelen = randrange(minlen, n+1) |
| 717 | return randslice_from_slicelen(slicelen, n) |
| 718 | |
| 719 | def rslices(n, allow_empty=False): |
| 720 | """Generate random slices for a single dimension.""" |
no test coverage detected