- #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!

You should upgrade or use an alternative browser.

- Fortran
- Thread starter michela02
- Start date

- #1

michela02

- 5

- 0

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!

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

- #4

Niles

- 1,868

- 0

If you need a very large amount of random numbers, then it may be beneficial to use the Mersenne twister: http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/VERSIONS/FORTRAN/fortran.html

Share:

- Replies
- 0

- Views
- 291

- Replies
- 1

- Views
- 807

- Replies
- 22

- Views
- 2K

- Last Post

- Replies
- 21

- Views
- 2K

Fortran
Floating Random Walk

- Last Post

- Replies
- 6

- Views
- 652

- Replies
- 2

- Views
- 850

- Last Post

- Replies
- 9

- Views
- 972

- Replies
- 25

- Views
- 2K

- Last Post

- Replies
- 12

- Views
- 587

- Last Post

- Replies
- 0

- Views
- 414