Using random values for multiple problems

I would like to create multiple problems with python generated random values. I don’t want to use multiple input fields but multiple submit buttons (problems). The mean idea is to break the task down into subtasks. But at the moment the random values are not valid for more than one problem. Does somebody maybe have a solution?