random_cantor_dust#

random_cantor_dust(shape, n: int = 5, p: int = 2, f: float = 0.8, seed: Optional[int] = None)[source]#

Generates an image of random cantor dust

Parameters:
  • shape (array_like) – The shape of the final image. If not evenly divisible by $p**n$ it will be increased to the nearest size that is.

  • n (int) – The number of times to iteratively divide the image.

  • p (int (default = 2)) – The number of divisions to make on each iteration.

  • f (float (default = 0.8)) – The fraction of the set to keep on each iteration.

  • seed (int, optional, default = None) – Initializes numpy’s random number generator to the specified state. If not provided, the current global value is used. This means calls to np.random.state(seed) prior to calling this function will be respected.

Returns:

dust – A boolean image of a random Cantor dust

Return type:

ndarray

Examples

Click here to view online example.