code: def rand(
      m, n, density=0.01, format="coo", dtype=None, random_state=None
  ):
      """Generates a random sparse matrix.
  
      See :func:`cupyx.scipy.sparse.random` for detail.
  
      Args:
          m (int): Number of rows.
          n (int): Number of cols.
          density (float): Ratio of non-zero entries.
          format (str): Matrix format.
          dtype (~cupy.dtype): Type of the returned matrix values.
          random_state (cupy.random.RandomState or int):
              State of random number generator.
              If an integer is given, the method makes a new state for random
              number generator and uses it.
              If it is not given, the default state is used.
              This state is used to generate random indexes for nonzero entries.
  
      Returns:
          cupyx.scipy.sparse.spmatrix: Generated matrix.
  
      .. seealso:: :func:`scipy.sparse.rand`
      .. seealso:: :func:`cupyx.scipy.sparse.random`
  
      """
      return random(m, n, density, format, dtype, random_state)
  
file_path: cupy/cupyx/scipy/sparse/_construct.py
imports: import numpy
  import cupy
  from cupyx.scipy.sparse import _coo
  from cupyx.scipy.sparse import _csc
  from cupyx.scipy.sparse import _csr
  from cupyx.scipy.sparse import _dia
  from cupyx.scipy.sparse import _sputils
label_desc: Use image node_id 9 for calling a global function with example usage: rand(m, n, density, format, dtype, random_state) and returns: random