mardi 9 avril 2019

How to use random.seed to create multiple different initial pseudo random numbers in Python?

I am using random.seed to generate pseudo-random numbers within a certain number of iterations. However, with this method, for the same number of iterations it generates the same initial value each time. I am wondering if there is a way to write the code to generate 4 different random initial values that are in different locations in the parameter range? For example my code below looks like:

import random

N=10
random.seed(N)
vx1 = [random.uniform(-3,3) for i in range(N)]

And each time this will generate the starting vx1 = 0.428. Is there a way to write the code for it to generate four different initial values of vx1? So the initial value for vx1 could equal 0.428 or 3 other values. Then each initial value would also have the following 9 random numbers in the range.




Aucun commentaire:

Enregistrer un commentaire