code: def random_sparse_csr(m, n, nnz_per_row):
      # Copied from the scipy.sparse benchmark.
      rows = np.arange(m).repeat(nnz_per_row)
      cols = np.random.randint(0, n, size=nnz_per_row * m)
      vals = np.random.random_sample(m * nnz_per_row)
      M = scipy.sparse.coo_matrix(
          (vals, (rows, cols)), (m, n), dtype=float
      )
      return M.tocsr()
  
file_path: scipy/benchmarks/benchmarks/sparse_linalg_expm.py
imports: import math
  import numpy
  from .common import Benchmark, safe_import
label_desc: Use image node_id 1 for calling a global function with example usage: random_sparse_csr(m, n, nnz_per_row) and returns: M