code: def random_targets(labels: np.ndarray, nb_classes: int) -> np.ndarray:
      """
      Given a set of correct labels, randomly changes some correct labels to target labels different from the original
      ones. These can be one-hot encoded or integers.
  
      :param labels: The correct labels.
      :param nb_classes: The number of classes for this model.
      :return: An array holding the randomly-selected target classes, one-hot encoded.
      """
      if len(labels.shape) > 1:
          labels = np.argmax(labels, axis=1)
  
      result = np.zeros(labels.shape)
  
      for class_ind in range(nb_classes):
          other_classes = list(range(nb_classes))
          other_classes.remove(class_ind)
          in_cl = labels == class_ind
          result[in_cl] = np.random.choice(other_classes)
  
      return to_categorical(result, nb_classes)
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import math
  import os
  import shutil
  import sys
  import tarfile
  import warnings
  import zipfile
  from functools import wraps
  from inspect import signature
  from typing import TYPE_CHECKING, Callable, List, Dict, Optional, Tuple, Union
  import numpy
  import six
  from scipy.special import gammainc
  from tqdm.auto import tqdm
  from art import config
label_desc: Use image node_id 14 for calling a global function with example usage: random_targets(labels, nb_classes) and returns: to_categorical