code: def shaped_random(
      shape, xp=cupy, dtype=numpy.float32, scale=10, seed=0, order="C"
  ):
      """Returns an array filled with random values.
  
      Args:
           shape(tuple): Shape of returned ndarray.
           xp(numpy or cupy): Array module to use.
           dtype(dtype): Dtype of returned ndarray.
           scale(float): Scaling factor of elements.
           seed(int): Random seed.
  
      Returns:
           numpy.ndarray or cupy.ndarray: The array with
           given shape, array module,
  
      If ``dtype`` is ``numpy.bool_``, the elements are
      independently drawn from ``True`` and ``False``
      with same probabilities.
      Otherwise, the array is filled with samples
      independently and identically drawn
      from uniform distribution over :math:`[0, scale)`
      with specified dtype.
      """
      numpy.random.seed(seed)
      dtype = numpy.dtype(dtype)
      if dtype == "?":
          a = numpy.random.randint(2, size=shape)
      elif dtype.kind == "c":
          a = numpy.random.rand(*shape) + 1j * numpy.random.rand(*shape)
          a *= scale
      else:
          a = numpy.random.rand(*shape) * scale
      return xp.asarray(a, dtype=dtype, order=order)
  
imports: import contextlib
  import inspect
  from typing import Callable
  import unittest
  from unittest import mock
  import warnings
  import numpy
  import cupy
  from cupy._core import internal
  import cupyx
  import cupyx.scipy.sparse
  from cupy.testing._pytest_impl import is_available
label_desc: Use image node_id 6 for calling a global function with example usage: shaped_random(shape, xp, dtype, scale, seed, order) and returns: xp