code: def random_masking(
      tokens: torch.tensor, mask_prob: float
  ) -> torch.Tensor:
      """
      Function to mask tokens randomly.
  
      Inputs:
          1) tokens: Tensor with token ids of shape (batch_size x seq_len)
          2) mask_prob: Probability of masking a particular token
  
      Outputs:
          mask: Tensor with same shape as input tokens (batch_size x seq_len)
              with masked  tokens represented by a 1 and everything else as 0.
      """
      batch_size, seq_len = tokens.size()
      num_masked_per_seq = int(seq_len * mask_prob)
  
      mask = np.zeros((batch_size, seq_len), dtype=np.int_)
      mask[:, :num_masked_per_seq] = 1
      for row in mask:
          np.random.shuffle(row)
      mask = torch.from_numpy(mask).to(tokens.device)
      return mask
  
imports: from enum import Enum
  import numpy
  import torch
label_desc: Use image node_id 1 for calling a global function with example usage: random_masking(tokens, mask_prob) and returns: mask