12345678910111213141516171819 |
- import random
- # !!!!!!!!!!!!!!!!! NOT UPDATED !!!!!!!!!!!!!!!!!!!!!
- # def get_random_dict_elements(dict_, count):
- # random_dict = {}
- # for i in range(0, count):
- # key, value = random.choice(list(dict_.items()))
- # random_dict[key] = value
- # return random_dict
- def get_random_list_elements(list_, count):
- list_2 = list_.copy()
- random_list = []
- for i in range(0, min(count,len(list_2))):
- elem = random.choice(list_2)
- random_list += [elem]
- list_2.remove(elem)
- return random_list
|