Fortran's Random numbers

  • Fortran
  • Thread starter michela02
  • Start date
  • #1
michela02
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
gsal
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
29,201
3,879


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).
 

Suggested for: Fortran's Random numbers

Replies
22
Views
2K
  • Last Post
Replies
21
Views
2K
  • Last Post
Replies
6
Views
652
Replies
2
Views
850
  • Last Post
Replies
9
Views
972
  • Last Post
Replies
12
Views
587
Replies
0
Views
414
Top