code: def random_blobs(shape, blobdensity, size, roughness=2.0):
      h, w = shape[:2]
      numblobs = max(1, int(blobdensity * w * h))  # Prevent being 0
      mask = np.zeros((h, w), np.uint8)
      for i in range(numblobs):
          mask[randint(0, h - 1), randint(0, w - 1)] = 1
      dt = cv.distanceTransform(1 - mask, cv.DIST_L2, 3)
      mask = np.array(dt < size, "f")
      mask = cv.GaussianBlur(
          mask,
          (0, 0),
          sigmaX=size / (2 * roughness),
          borderType=cv.BORDER_REFLECT,
      )
      mask -= np.amin(mask)
      mask /= np.amax(mask)
      noise = np.random.rand(h, w)
      noise = cv.GaussianBlur(
          noise,
          (0, 0),
          sigmaX=size / (2 * roughness),
          borderType=cv.BORDER_REFLECT,
      )
      noise -= np.amin(noise)
      noise /= np.amax(noise)
      return np.array(mask * noise > 0.5, "f")
  
imports: import random
  from random import randint
  import numpy
  import cv2
label_desc: Use image node_id 13 for calling a global function with example usage: random_blobs(shape, blobdensity, size, roughness) and returns: np