- #1
Animastryfe
- 81
- 0
Hello,
I was given a program written by someone else that uses random_seed and random_number to generate a matrix. I thought the output of that program should change because each execution of that program should use a different random number to create the matrix, but the output is always the same, even after I recompile the program.
So I am trying to figure out how random_seed and random_number works in fortran. I'm using the example program given on the random_number page:
This should give me a different number each time I execute it, right? But it isn't. It gives me the same number even after I recompile. I did not specify any arguments for random_seed because the program I was working with did not specify any arguments for random_seed.
What am I missing about how these two subroutines work?
I was given a program written by someone else that uses random_seed and random_number to generate a matrix. I thought the output of that program should change because each execution of that program should use a different random number to create the matrix, but the output is always the same, even after I recompile the program.
So I am trying to figure out how random_seed and random_number works in fortran. I'm using the example program given on the random_number page:
Code:
program test_random_number
REAL(8) :: r
CALL random_seed()
CALL RANDOM_NUMBER(r)
print *, r
end program
This should give me a different number each time I execute it, right? But it isn't. It gives me the same number even after I recompile. I did not specify any arguments for random_seed because the program I was working with did not specify any arguments for random_seed.
What am I missing about how these two subroutines work?