I am trying to make a q table. But as I am creating my q table I notice that all of my values are the same even as I changed the random.seed and used multiple variants of randint, such as np.random.uniform and random.uniform. My code is below
import os, time, random start = time.time() class space_info: SIZE = 10 class blob(): value = None q_table = {} def init(self): SIZE = space_info.SIZE for i in range(-SIZE+1, SIZE): for ii in range(-SIZE+1, SIZE): for iii in range(-SIZE+1, SIZE): for iiii in range(-SIZE+1, SIZE): random.seed(time.time()*1000000) self.q_table[((i, ii), (iii, iiii))] = [random.uniform(-5, 0) for i in range(4)] os.system('clear') x = blob() x.init() z = blob() z.init() if (z.q_table[((-9, -2), (3, 9))]) == (x.q_table[((-9, -2), (3, 9))]): print("WE FAILED ):") print(z.q_table[((-9, -2), (3, 9))]) print(x.q_table[((-9, -2), (3, 9))]) else: print("YES") How can I get new numbers for my q_table?
random.seed()at all in this code. If you must use it, calling it once at the top would be sufficient.randomandnp.randomare completely separate implementations. Using theseed()function from one does nothing to the other. In other words, you must use theseed()function corresponding to the generator you're using.