code: def reservoir_sampling(data, nsamples, prng=None):
      if prng is None:
          prng = random
  
      result = []
      for i, entry in enumerate(data):
          if i < nsamples:
              result.append(entry)
          else:
              j = prng.randint(0, i)
              if j < nsamples:
                  result[j] = entry
      return result
  
label_desc: Use image node_id 1 for calling a global function with example usage: reservoir_sampling(data, nsamples, prng) and returns: result