class_docstr: 随机顺序的 Sampler 。
  
  :param dataset: 实现了 __len__ 方法的数据容器
  :param shuffle: 是否在每次 iterate 的时候打乱顺序
  :param seed: 随机数种子
  :param kwargs: fastNLP 内部使用的参数
class_docstr_tok: ["\u968f\u673a\u987a\u5e8f\u7684","Sampler","\u3002",":","param","dataset",":","\u5b9e\u73b0\u4e86","__len__","\u65b9\u6cd5\u7684\u6570\u636e\u5bb9\u5668",":","param","shuffle",":","\u662f\u5426\u5728\u6bcf\u6b21","iterate","\u7684\u65f6\u5019\u6253\u4e71\u987a\u5e8f",":","param","seed",":","\u968f\u673a\u6570\u79cd\u5b50",":","param","kwargs",":","fastNLP","\u5185\u90e8\u4f7f\u7528\u7684\u53c2\u6570"]
code: def __init__(
      self, dataset, shuffle: bool = True, seed: int = 0, **kwargs
  ):
      super(RandomSampler, self).__init__()
      self.dataset = dataset
      self.shuffle = shuffle
      self.seed = int(seed)
  
      self.num_consumed_samples = kwargs.get(
          "num_consumed_samples", 0
      )  # 总共迭代了多少数据了，包括多卡情况下的其它卡上的输出的数量
  
      # 多卡的相关的参数
      self.num_replicas = kwargs.get("num_replicas", 1)
      self.rank = kwargs.get("rank", 0)
      self.epoch = kwargs.get("epoch", -1)
      self.pad = kwargs.get("pad", False)  # 该参数在单卡上不具有任何意义；
  
      # 是否处于iteration之间，为True不允许调用 set_distributed()和load_state_dict()
      self.during_iter = kwargs.get("during_iter", False)
  
imports: from typing import Dict, List, Union, Sequence
  import math
  import numpy
  from fastNLP.core.log import logger
  from fastNLP.core.dataset import DataSet
label_desc: Use image node_id 1 to create a new RandomSampler object from inherited base classes: ReproducibleSampler with example: obj = RandomSampler(dataset, shuffle, seed)