Assuming you want to select a random single element, you can use random.choice
twice: first to select a list within the list of lists at random, then to randomly choose from that list.
import random
rand = random.choice(random.choice(self.taula))
Note this works well when the nested lists are of equal length as each individual element has an equal likelihood of being randomly selected. However, if they are uneven, as in the below example, it does affect the randomness of the selection.
[
[1, 2, 3],
[4, 5, 6, 7, 8, 9, 10],
[0]
]
0
has a 1-in-3 chance of being picked, but 10
has a 1-in-21 chance of being picked.
To address this, you can flatten the list, and then choose from that.
flat = [y for x in self.taula for y in x]
random.choice(flat)