0

I am confused about how random seed subroutine works in fortran. without any argument it takes the seed automatically from machine but I don't know how we can manually provide seed because we don't know what size it has. Also in some examples I have seen they just provide the variable for seed size and then write random_seed(get=seed), how this works? Does it takes seed automatically from machine

Pirateking
  • 37
  • 5
  • We have several questiins and answers about this. We do know the size of the seed, the `random_seed` subroutine gives us that size, please see the manual https://gcc.gnu.org/onlinedocs/gcc-5.1.0/gfortran/RANDOM_005fSEED.html `size=` is the first argument. Also, please use tag [tag:fortran] for Fortran questions. Fortran 90 is just one very old revision of the standard. – Vladimir F Героям слава Jan 30 '22 at 19:02
  • 1
    Does this answer your question? [Correctly setting random seeds for repeatability](https://stackoverflow.com/questions/51893720/correctly-setting-random-seeds-for-repeatability) or [Using a specific seed in the `RANDOM_NUMBER` algorithm](https://stackoverflow.com/questions/40230751/using-a-specific-seed-in-the-random-number-algorithm) – Vladimir F Героям слава Jan 30 '22 at 19:05
  • 1
    Note that in modern Fortran you can just use `random_init()` https://stackoverflow.com/a/60117743/721644 – Vladimir F Героям слава Jan 30 '22 at 19:11
  • Sorry, for a more recent link to the manual use https://gcc.gnu.org/onlinedocs/gfortran/RANDOM_005fSEED.html instead of the link above. For random_init it is https://gcc.gnu.org/onlinedocs/gfortran/RANDOM_005fINIT.html#RANDOM_005fINIT – Vladimir F Героям слава Jan 30 '22 at 21:01

0 Answers0