code: def random_prob_generator(
      batch_size: int,
      p: float = 0.5,
      same_on_batch: bool = False,
      device: torch.device = torch.device("cpu"),
      dtype: torch.dtype = torch.float32,
  ) -> Tensor:
      r"""Generate random probabilities for a batch of inputs.
  
      Args:
          batch_size (int): the number of images.
          p (float): probability to generate an 1-d binary mask. Default value is 0.5.
          same_on_batch (bool): apply the same transformation across the batch. Default: False.
          device (torch.device): the device on which the random numbers will be generated. Default: cpu.
          dtype (torch.dtype): the data type of the generated random numbers. Default: float32.
  
      Returns:
          Tensor: parameters to be passed for transformation.
              - probs (Tensor): element-wise probabilities with a shape of (B,).
  
      Note:
          The generated random numbers are not reproducible across different devices and dtypes.
      """
      _common_param_check(batch_size, same_on_batch)
      if not isinstance(p, (int, float)) or p > 1 or p < 0:
          raise TypeError(
              f"The probability should be a float number within [0, 1]. Got {type(p)}."
          )
  
      _bernoulli = Bernoulli(
          tensor(float(p), device=device, dtype=dtype)
      )
      probs_mask: Tensor = _adapted_sampling(
          (batch_size,), _bernoulli, same_on_batch
      ).bool()
  
      return probs_mask
  
file_path: kornia/kornia/augmentation/random_generator/_2d/probability.py
imports: from typing import Dict, Tuple
  import torch
  from torch.distributions import Bernoulli
  from kornia.augmentation.random_generator.base import RandomGeneratorBase
  from kornia.augmentation.utils import _adapted_sampling, _common_param_check
  from kornia.core import Tensor, tensor
label_desc: Use image node_id 1 for calling a global function with example usage: random_prob_generator(batch_size, p, same_on_batch, device, dtype) and returns: probs_mask