class_docstr: Fast weighted sampling.
  
  list-like data structure
  append, update are O(log n)
  summation over an interval is O(log n) per query
class_docstr_tok: ["Fast","weighted","sampling",".","list-like","data","structure","append",",","update","are","O","(","log","n",")","summation","over","an","interval","is","O","(","log","n",")","per","query"]
code: def prioritized_sample(self, n, remove=False):
      assert n >= 0
      ixs = []
      vals = []
      total_val = self.s  # save this before it changes by removing
      for _ in range(n):
          ix, val = self._pick(np.random.uniform(0.0, self.s))
          ixs.append(ix)
          vals.append(val)
          self._write(ix, 0.0)
      if not remove:
          for ix, val in zip(ixs, vals):
              self._write(ix, val)
      return ixs, [v / total_val for v in vals]
  
imports: import collections
  import numpy
  from chainerrl.misc.random import sample_n_k
label_desc: Use image node_id 13 for calling the SumTree obj's underlying member method code with example usage: obj.prioritized_sample(n, remove) and returns: ixs,  unknown