0

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

Roshin Raphel
  • 2,612
  • 4
  • 22
  • 40
  • Does this answer your question? [Generate random integers between 0 and 9](https://stackoverflow.com/questions/3996904/generate-random-integers-between-0-and-9) – Ken Kinder Jun 01 '20 at 14:23
  • 1
    I think the issue exists in the `Simulation` class... could you add it to your code? – Anwarvic Jun 01 '20 at 14:25
  • @Anwarvic the simulation class works perfectly, I matched the results. The problem is that I have to run the simulation over and over again one hundred times, and doing that with this **for** loop generates the same results 100 times. Also when I completely remove the for loop and click run over and over again I get different results, it's just when I use a **for** loop to run it 100 times I get the same results. – Bhavya Jain Jun 02 '20 at 10:33

0 Answers0