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)
| 721 | return product(*iterables) |
| 722 | |
| 723 | def rslice(n, allow_empty=False): |
| 724 | """Generate random slice for a single dimension of length n. |
| 725 | If zero=True, the slices may be empty, otherwise they will |
| 726 | be non-empty.""" |
| 727 | minlen = 0 if allow_empty or n == 0 else 1 |
| 728 | slicelen = randrange(minlen, n+1) |
| 729 | return randslice_from_slicelen(slicelen, n) |
| 730 | |
| 731 | def rslices(n, allow_empty=False): |
| 732 | """Generate random slices for a single dimension.""" |
no test coverage detected
searching dependent graphs…