code: def numpy_random_seed(seed=42):
      
      old_state = np.random.get_state()
      np.random.seed(seed)
      try:
          yield
      finally:
          np.random.set_state(old_state)
docs: sets the random seed of numpy within the context.
  
      Example
      -------
      >>> import numpy as np
      >>> with numpy_random_seed(seed=0):
      ...    np.random.randint(1000)
      684