Fortran's Random numbers

  • Fortran
  • Thread starter michela02
  • Start date
  • #1
5
0
Fortran's Random numbers!!

Hi everyone!
I have a doubt about random numbers on Fortran: how does the computer choose random numbers? Why don't they change each time I run the programme? Are they really random then?
Thanks!
 

Answers and Replies

  • #2
1,065
54


randomness in itself is a complicated matter...I think you need to read up on it.

I don't know much about randomness, all I can tell is that I can imagine different algorithms are probably designed to generate a series of random numbers, where the randomness has to do with the fact that the numbers do not follow a certain pattern or sequence or something...now, because it is an algorithm that generates the numbers, there is a repeatability in the process, the process is started with what is called a seed...whenever you start with the same seed, the sequence of numbers is going to be the same...again, that does not mean that it is not a random sequence...got it? the randomnes is in the non-pattern of the sequence.
 
  • #3
Borek
Mentor
28,816
3,323


They are pseudorandom, most likely prepared using linear congruential generator. You should be able to modify the seed (which will make the sequence different each time).
 

Related Threads on Fortran's Random numbers

Replies
3
Views
8K
Replies
12
Views
2K
  • Last Post
Replies
13
Views
3K
Replies
2
Views
16K
  • Last Post
Replies
3
Views
3K
Replies
9
Views
1K
Replies
2
Views
722
  • Last Post
Replies
5
Views
682
  • Last Post
Replies
4
Views
2K
Top