parameters: (self, _max_size, _random=None)
docstring: Create the _ReservoirBucket.
  
      Args:
        _max_size: The maximum size the reservoir bucket may grow to. If size is
          zero, the bucket has unbounded size.
        _random: The random number generator to use. If not specified, defaults to
          random.Random(0).
  
      Raises:
        ValueError: if the size is not a nonnegative integer.
docstring_summary: Create the _ReservoirBucket.
docstring_tokens: Create the _ReservoirBucket .
function: def __init__(self, _max_size, _random=None):
      """Create the _ReservoirBucket.
  
      Args:
        _max_size: The maximum size the reservoir bucket may grow to. If size is
          zero, the bucket has unbounded size.
        _random: The random number generator to use. If not specified, defaults to
          random.Random(0).
  
      Raises:
        ValueError: if the size is not a nonnegative integer.
      """
      if _max_size < 0 or _max_size != round(_max_size):
        raise ValueError('_max_size must be nonegative int, was %s' % _max_size)
      self.items = []
      # This mutex protects the internal items, ensuring that calls to Items and
      # AddItem are thread-safe
      self._mutex = threading.Lock()
      self._max_size = _max_size
      self._num_items_seen = 0
      if _random is not None:
        self._random = _random
      else:
        self._random = random.Random(0)
function_tokens: def __init__ ( self , _max_size , _random = None ) : if _max_size < 0 or _max_size != round ( _max_size ) : raise ValueError ( '_max_size must be nonegative int, was %s' % _max_size ) self . items = [ ] # This mutex protects the internal items, ensuring that calls to Items and # AddItem are thread-safe self . _mutex = threading . Lock ( ) self . _max_size = _max_size self . _num_items_seen = 0 if _random is not None : self . _random = _random else : self . _random = random . Random ( 0 )