lundi 1 juin 2020

Generate stream of random numbers in python

I am trying to generate a stream of unique random numbers in python for a simulation model. I want to run the simulation for 100 replications i.e. 100 times. This is what I tried

    s=Simulation()
    for i in range(100):         #performs 100 simulation runs
        np.random.seed(i)
        while s.clock <= 240:    #runs the simulation model for 240 minutes
            s.time_adv()  
        print(s.num_arrival)     #print the number of arrivals in in each simulation run

This is the output i get every time 85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,

I want each simulation run, out of the 100 runs, to have a unique sequence of random numbers




Aucun commentaire:

Enregistrer un commentaire