code: def random_cp(
      shape: Sequence[int],
      rank: int,
      /,
      *,
      dtype: Optional[Union[ivy.Dtype, ivy.NativeDtype]] = None,
      full: Optional[bool] = False,
      orthogonal: Optional[bool] = False,
      seed: Optional[int] = None,
      normalise_factors: Optional[bool] = True,
  ) -> Union[ivy.CPTensor, ivy.Array]:
      """Generate a random CP tensor.
  
      Parameters
      ----------
      shape
          shape of the tensor to generate
      rank
          rank of the CP decomposition
      full
          if True, a full tensor is returned
          otherwise, the decomposed tensor is returned
      orthogonal
          if True, creates a tensor with orthogonal components
      seed
          seed for generating random numbers
  
      Returns
      -------
          ivy.CPTensor
      """
      rank = ivy.CPTensor.validate_cp_rank(shape, rank)
      if (rank > min(shape)) and orthogonal:
          warnings.warn(
              "Can only construct orthogonal tensors when rank <= min(shape) but got "
              f"a tensor with min(shape)={min(shape)} < rank={rank}"
          )
  
      factors = [
          (ivy.random_uniform(shape=(s, rank), dtype=dtype, seed=seed))
          for s in shape
      ]
      weights = ivy.ones((rank,), dtype=dtype)
      if orthogonal:
          factors = [ivy.qr(factor)[0] for factor in factors]
  
      if full:
          return ivy.CPTensor.cp_to_tensor((weights, factors))
      elif normalise_factors:
          return ivy.CPTensor.cp_normalize((weights, factors))
      else:
          return ivy.CPTensor((weights, factors))
  
imports: from typing import Union, Tuple, Optional, Sequence, Iterable, Generator
  import warnings
  import ivy
  from ivy.utils.backend import current_backend
  from ivy.utils.exceptions import handle_exceptions
  from ivy.func_wrapper import outputs_to_ivy_arrays, handle_nestable, to_native_arrays_and_back, handle_out_argument, infer_dtype, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_backend_invalid, handle_array_function
label_desc: Use image node_id 16 for calling a global function with example usage: random_cp() and returns: ivy, ivy, ivy