def METHOD_NAME(self, a_number, a_dictionary, rng):
    keys = sorted(a_dictionary.keys())
    a_number = min(int(a_number), len(keys))
    ret = {}
    for k1 in rng.choice(keys, a_number, replace=False):
        ret[ k1 ] = a_dictionary[ k1 ]
    return ret