How Does Fortran Generate Random Numbers?

  • Context: Fortran 
  • Thread starter Thread starter michela02
  • Start date Start date
  • Tags Tags
    Numbers Random
Click For Summary

Discussion Overview

The discussion revolves around how Fortran generates random numbers, focusing on the nature of randomness, the algorithms used, and the concept of seeds in generating pseudorandom sequences. Participants explore both theoretical and practical aspects of random number generation in Fortran.

Discussion Character

  • Exploratory, Technical explanation, Conceptual clarification

Main Points Raised

  • One participant expresses confusion about how random numbers are generated in Fortran and questions their randomness and consistency across program runs.
  • Another participant suggests that randomness is complex and implies that various algorithms exist to generate random numbers, emphasizing the role of seeds in producing repeatable sequences.
  • It is mentioned that the random numbers generated are pseudorandom, likely produced by a linear congruential generator, and that modifying the seed can alter the sequence of numbers generated.
  • A suggestion is made to use the Mersenne twister for generating a large quantity of random numbers, linking to an external resource for further information.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the nature of randomness in Fortran's random number generation, with multiple viewpoints presented regarding the algorithms and the implications of using seeds.

Contextual Notes

Participants do not fully explore the implications of pseudorandomness versus true randomness, nor do they clarify the specific algorithms used in Fortran beyond the mention of linear congruential generators and the Mersenne twister.

michela02
Messages
5
Reaction score
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!
 
Technology news on Phys.org


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.
 


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

Similar threads

  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 21 ·
Replies
21
Views
8K
  • · Replies 26 ·
Replies
26
Views
10K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 4 ·
Replies
4
Views
8K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K