code: def random_save(rnd: Optional[tcod.random.Random]) -> tcod.random.Random:
      
      return tcod.random.Random._new_from_cdata(
          ffi.gc(
              ffi.cast(
                  "mersenne_data_t*",
                  lib.TCOD_random_save(rnd.random_c if rnd else ffi.NULL),
              ),
              lib.TCOD_random_delete,
          )
      )
docs: Return a copy of a random number generator.
  
      .. deprecated:: 8.4
          You can use the standard library copy and pickle modules to save a
          random state.