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

Generates an image of random cantor dust

  • 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.


dust – A boolean image of a random Cantor dust

Return type:



Click here to view online example.