code: def write_random_state(self, group=None, state=None):
          
          group = self.sampler_group if group is None else group
          dataset_name = "/".join([group, "random_state"])
          if state is None:
              state = numpy.random.get_state()
          s, arr, pos, has_gauss, cached_gauss = state
          if dataset_name in self:
              self[dataset_name][:] = arr
          else:
              self.create_dataset(dataset_name, arr.shape, fletcher32=True,
                                  dtype=arr.dtype)
              self[dataset_name][:] = arr
          self[dataset_name].attrs["s"] = s
          self[dataset_name].attrs["pos"] = pos
          self[dataset_name].attrs["has_gauss"] = has_gauss
          self[dataset_name].attrs["cached_gauss"] = cached_gauss
docs: Writes the state of the random number generator from the file.
  
          The random state is written to ``sampler_group``/random_state.
  
          Parameters
          ----------
          group : str
              Name of group to write random state to.
          state : tuple, optional
              Specify the random state to write. If None, will use
              ``numpy.random.get_state()``.