code: def _assign_random_weights(G, seed=None):
      """Assigns random weights to the edges of a graph.
  
      Parameters
      ----------
  
      G : NetworkX graph
          The original graph for which the spanner was constructed.
  
      seed : integer, random_state, or None (default)
          Indicator of random number generation state.
          See :ref:`Randomness<randomness>`.
      """
      for u, v in G.edges():
          G[u][v]["weight"] = seed.random()
  
file_path: networkx/networkx/algorithms/tests/test_sparsifiers.py
imports: import pytest
  import networkx
  from networkx.utils import py_random_state
label_desc: Use image node_id 2 for calling a global function with example usage: _assign_random_weights(G, seed) without return types