code: def random_sphere(
      nb_points: int,
      nb_dims: int,
      radius: Union[int, float, np.ndarray],
      norm: Union[int, float, str],
  ) -> np.ndarray:
      """
      Generate uniformly at random `m x n`-dimension points in the `norm`-norm ball with radius `radius` and centered
      around 0.
  
      :param nb_points: Number of random data points.
      :param nb_dims: Dimensionality of the sphere.
      :param radius: Radius of the sphere.
      :param norm: Current support: 1, 2, np.inf, "inf".
      :return: The generated random sphere.
      """
      if norm == 1:
          if isinstance(radius, np.ndarray):
              raise NotImplementedError(
                  "The parameter `radius` of type `np.ndarray` is not supported to use with norm 1."
              )
  
          var_u = np.random.uniform(size=(nb_points, nb_dims))
          var_v = np.sort(var_u)
          v_pre = np.concatenate(
              (np.zeros((nb_points, 1)), var_v[:, : nb_dims - 1]),
              axis=-1,
          )
          x = var_v - v_pre
          res = (
              radius
              * x
              * np.random.choice([-1, 1], (nb_points, nb_dims))
          )
  
      elif norm == 2:
          if isinstance(radius, np.ndarray):
              raise NotImplementedError(
                  "The parameter `radius` of type `np.ndarray` is not supported to use with norm 2."
              )
  
          a_tmp = np.random.randn(nb_points, nb_dims)
          s_2 = np.sum(a_tmp**2, axis=1)
          base = (
              gammainc(nb_dims / 2.0, s_2 / 2.0) ** (1 / nb_dims)
              * radius
              / np.sqrt(s_2)
          )
          res = a_tmp * (np.tile(base, (nb_dims, 1))).T
  
      elif norm in [np.inf, "inf"]:
          if isinstance(radius, np.ndarray):
              radius = radius * np.ones(shape=(nb_points, nb_dims))
  
          res = np.random.uniform(-radius, radius, (nb_points, nb_dims))
  
      else:
          raise NotImplementedError(f"Norm {norm} not supported")
  
      return res
  
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 6 for calling a global function with example usage: random_sphere(nb_points, nb_dims, radius, norm) and returns: res