class_docstr: Base class for LIT datasets.
docstr: Return a new dataset with a random subset of examples.
docstr_tok: ["Return","a","new","dataset","with","a","random","subset","of","examples","."]
code: def sample(self, n, seed=42):
      """Return a new dataset with a random subset of examples."""
      rng = random.Random(seed)
      if n < len(self.examples):
          examples = rng.sample(self.examples, n)
      else:
          logging.warning(
              "Requested sample %d is larger than dataset size %d; returning full"
              " dataset.",
              n,
              len(self.examples),
          )
          examples = list(self.examples)
      return Dataset(examples=examples, base=self)
  
imports: from collections.abc import Callable, Mapping, Sequence
  import hashlib
  import glob
  import inspect
  import os
  import random
  import types
  from typing import Optional, Union, cast
  from absl import logging
  from lit_nlp.api import types
  from lit_nlp.lib import serialize
  from lit_nlp.lib import utils
label_desc: Use image node_id 10 for calling the Dataset obj's underlying member method code with example usage: obj.sample(n, seed) and returns: Dataset