I am writing a code which requires to uniformly generate random numbers out of several given for different tasks. For example consider:
p = [0,1,2,3]
wt = [0.1,0.7,0.2,0.5]
random.seed = inputseed
random.choices(population=p, weights=wt)
Seed is fixed for all tasks.
Do I need to create separate random generator for each tasks for samples for those tasks to be uniformly random independent of other tasks? Something like this:
rgen = random.Random(inputseed)
rgen.choices(population=p, weights=wt)
Is there any more consideration while using random
for more than one logical tasks and also in multi threaded environment?
PS: I am on python-3.8.2
Aucun commentaire:
Enregistrer un commentaire