code: def ball(key, d, p=2.0, shape=(), dtype="float64"):
      seed = _get_seed(key)
      d = operator.index(d)
  
      g = ivy.gamma(1 / p, 1.0, shape=shape, dtype=dtype, seed=seed)
      b = ivy.bernoulli(
          ivy.array([0.5]), shape=shape, dtype=dtype, seed=seed
      )
      r = 2 * b - 1
      gn = r * g ** (1 / p)
  
      uniform = ivy.random_uniform(seed=seed, shape=shape, dtype=dtype)
      exp = -ivy.log(1 - uniform)
  
      return (
          gn
          / (((ivy.abs(gn) ** p).sum(axis=-1) + exp) ** (1 / p))[
              ..., None
          ]
      )
  
imports: import operator
  import ivy
  from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
  from ivy.functional.frontends.jax.func_wrapper import to_ivy_arrays_and_back, handle_jax_dtype
label_desc: Use image node_id 4 for calling a global function with example usage: ball(key, d, p, shape, dtype) and returns: unknown