Generate random slice tuples for 'shape'.
(ndim, shape, iterations=5)
| 722 | yield rslice(n, allow_empty) |
| 723 | |
| 724 | def rslices_ndim(ndim, shape, iterations=5): |
| 725 | """Generate random slice tuples for 'shape'.""" |
| 726 | # non-empty slices |
| 727 | for _ in range(iterations): |
| 728 | yield tuple(rslice(shape[n]) for n in range(ndim)) |
| 729 | # possibly empty slices |
| 730 | for _ in range(iterations): |
| 731 | yield tuple(rslice(shape[n], allow_empty=True) for n in range(ndim)) |
| 732 | # invalid slices |
| 733 | yield tuple(slice(0,1,0) for _ in range(ndim)) |
| 734 | |
| 735 | def rpermutation(iterable, r=None): |
| 736 | pool = tuple(iterable) |
no test coverage detected