def zipf_random_sample(distr_map, sample_len):
    "Helper function: Generate a random Zipf sample of given length.\n\n  Args:\n    distr_map: list of float, Zipf's distribution over nbr_symbols.\n    sample_len: integer, length of sequence to generate.\n\n  Returns:\n    sample: list of integer, Zipf's random sample over nbr_symbols.\n\n  "
    u = np.random.random(sample_len)
    return list(np.searchsorted(distr_map, u))
Helper function: Generate a random Zipf sample of given length.

Args:
  distr_map: list of float, Zipf's distribution over nbr_symbols.
  sample_len: integer, length of sequence to generate.

Returns:
  sample: list of integer, Zipf's random sample over nbr_symbols.
def zipf_random_sample(distr_map, sample_len):
    "Helper function: Generate a random Zipf sample of given length.\n\n  Args:\n    distr_map: list of float, Zipf's distribution over nbr_symbols.\n    sample_len: integer, length of sequence to generate.\n\n  Returns:\n    sample: list of integer, Zipf's random sample over nbr_symbols.\n\n  "
    u = np.random.random(sample_len)
    return list(np.searchsorted(distr_map, u))