RandomOrder

Apply a random subset of transforms from the given list in a random order.

Selects exactly n transforms uniformly at random from the list, and then applies the selected transforms in a random order. Each selected transform is applied based on its individual probability p.

Examples
>>> import albumentations as A
>>> transform = A.RandomOrder([
...     A.HorizontalFlip(p=0.5),
...     A.VerticalFlip(p=1.0),
...     A.RandomBrightnessContrast(p=0.8),
... ], n=2, replace=False, p=1.0)
>>> # This will uniformly select 2 transforms and apply them in a random order,
>>> # respecting their individual probabilities (0.5, 1.0, 0.8).
Notes
  • Inherits from SomeOf, but overrides _get_idx to ensure random order without sorting.
  • Selection is uniform; application depends on individual transform probabilities.