Say for example I have the following dictionary in Python:
memory_map = {'data': [1,2,3], 'theta': [4,5,6,7]}
I would like to create another random dictionary that is identical to memory_map
, has the same keys and the same lengths of lists as their values however the elements of the list are populated with random values using the np.random.default_rng(seed).uniform(low, high, size)
function.
An example would be: random_dict = {'data': [5,3,1], 'theta': [7,3,4,8]}
.
Moreover, if the names of the keys or the lengths of the lists in values change, this should automatically be reflected in the random_dict
that is created.
If I add a new key or remove a key from the memory_map
this should also be reflected in the random_dict
.
So far, I have random_dict = {item: [] for item in list(memory_map.keys())}
but am unsure of how to populate the empty list with the random values of the same length.
Thanks.