code: def simulate_run(res, rstate=None, return_idx=False, approx=False):
      
  
      if rstate is None:
          rstate = np.random
  
      # Resample run.
      new_res, samp_idx = resample_run(res, rstate=rstate, return_idx=True)
  
      # Jitter run.
      new_res = jitter_run(new_res, rstate=rstate, approx=approx)
  
      if return_idx:
          return new_res, samp_idx
      else:
          return new_res
docs: Probes **combined uncertainties** (statistical and sampling) on a nested
      sampling run by wrapping :meth:`jitter_run` and :meth:`resample_run`.
  
      Parameters
      ----------
      res : :class:`~dynesty.results.Results` instance
          The :class:`~dynesty.results.Results` instance taken from a previous
          nested sampling run.
  
      rstate : `~numpy.random.RandomState`, optional
          `~numpy.random.RandomState` instance.
  
      return_idx : bool, optional
          Whether to return the list of resampled indices used to construct
          the new run. Default is `False`.
  
      approx : bool, optional
          Whether to approximate all sets of uniform order statistics by their
          associated marginals (from the Beta distribution). Default is `False`.
  
      Returns
      -------
      new_res : :class:`~dynesty.results.Results` instance
          A new :class:`~dynesty.results.Results` instance with corresponding
          samples and weights based on our "simulated" samples and
          prior volumes.