Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fortran's Random numbers

  1. Jan 18, 2013 #1
    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?
  2. jcsd
  3. Jan 18, 2013 #2
    Re: Fortran's Random numbers!!

    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.
  4. Jan 19, 2013 #3


    User Avatar

    Staff: Mentor

    Re: Fortran's Random numbers!!

    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).
  5. Jan 19, 2013 #4
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook