code: def random_coordinates_from_surface(
      nb_triangles,
      nb_seed,
      triangles_mask=None,
      triangles_weight=None,
      rand_gen=None,
  ):
      """Generate random triangles_indices and trilinear_coord
  
      Triangles_indices probability are weighted by triangles_weight,
          for each triangles inside the given triangles_mask
  
      Parameters
      ----------
      nb_triangles : int (n)
          The amount of triangles in the mesh
      nb_seed : int
          The number of random indices and coordinates generated.
      triangles_mask : [n] numpy array
          Specifies which triangles should be chosen (or not)
      triangles_weight : [n] numpy array
          Specifies the weight/probability of choosing each triangle
      rand_gen : int
          The seed for the random seed generator (numpy.random.seed).
  
      Returns
      -------
      triangles_idx: [s] array
          Randomly chosen triangles_indices
      trilin_coord: [s,3] array
          Randomly chosen trilinear_coordinates
  
      See Also
      --------
      seeds_from_surface_coordinates, random_seeds_from_mask
      """
      # Compute triangles_weight in vts_mask
      if triangles_mask is not None:
          if triangles_weight is None:
              triangles_weight = triangles_mask.astype(float)
          else:
              triangles_weight *= triangles_mask.astype(float)
  
      # Normalize weights to have probability (sum to 1)
      if triangles_weight is not None:
          triangles_weight /= triangles_weight.sum()
  
      # Set the random seed generator
      rng = np.random.default_rng(rand_gen)
  
      # Choose random triangles
      triangles_idx = rng.choice(
          nb_triangles, size=nb_seed, p=triangles_weight
      )
  
      # Choose random trilinear coordinates
      # https://mathworld.wolfram.com/TrianglePointPicking.html
      trilin_coord = rng.random((nb_seed, 3))
      is_upper = trilin_coord[:, 1:].sum(axis=-1) > 1.0
      trilin_coord[is_upper] = 1.0 - trilin_coord[is_upper]
      trilin_coord[:, 0] = 1.0 - (
          trilin_coord[:, 1] + trilin_coord[:, 2]
      )
  
      return triangles_idx, trilin_coord
  
imports: import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: random_coordinates_from_surface(nb_triangles, nb_seed, triangles_mask, triangles_weight, rand_gen) and returns: triangles_idx,  trilin_coord