code: def rand(
      m, n, density=0.01, format="coo", dtype=None, random_state=None
  ):
      """Generate a sparse matrix of the given shape and density with uniformly
      distributed values.
  
      Parameters
      ----------
      m, n : int
          shape of the matrix
      density : real, optional
          density of the generated matrix: density equal to one means a full
          matrix, density of 0 means a matrix with no non-zero items.
      format : str, optional
          sparse matrix format.
      dtype : dtype, optional
          type of the returned matrix values.
      random_state : {None, int, `numpy.random.Generator`,
                      `numpy.random.RandomState`}, optional
  
          If `seed` is None (or `np.random`), the `numpy.random.RandomState`
          singleton is used.
          If `seed` is an int, a new ``RandomState`` instance is used,
          seeded with `seed`.
          If `seed` is already a ``Generator`` or ``RandomState`` instance then
          that instance is used.
  
      Returns
      -------
      res : sparse matrix
  
      Notes
      -----
      Only float types are supported for now.
  
      See Also
      --------
      scipy.sparse.random : Similar function that allows a user-specified random
          data source.
  
      Examples
      --------
      >>> from scipy.sparse import rand
      >>> matrix = rand(3, 4, density=0.25, format="csr", random_state=42)
      >>> matrix
      <3x4 sparse matrix of type '<class 'numpy.float64'>'
         with 3 stored elements in Compressed Sparse Row format>
      >>> matrix.todense()
      matrix([[0.05641158, 0.        , 0.        , 0.65088847],
              [0.        , 0.        , 0.        , 0.14286682],
              [0.        , 0.        , 0.        , 0.        ]])
  
      """
      return random(m, n, density, format, dtype, random_state)
  
imports: import numbers
  from functools import partial
  import numpy
  from scipy._lib._util import check_random_state, rng_integers
  from .sputils import upcast, get_index_dtype, isscalarlike
  from .csr import csr_matrix
  from .csc import csc_matrix
  from .bsr import bsr_matrix
  from .coo import coo_matrix
  from .dia import dia_matrix
  from .base import issparse
label_desc: Use image node_id 13 for calling a global function with example usage: rand(m, n, density, format, dtype, random_state) and returns: random