[fortran, doc] Improve random_seed example
Janne Blomqvist
blomqvist.janne@gmail.com
Fri May 17 19:20:00 GMT 2013
On Fri, May 17, 2013 at 5:15 PM, Angelo Graziosi
<angelo.graziosi@alice.it> wrote:
> Ciao Janne,
>
>
> Janne Blomqvist wrote:
>
>> the example we provide for the usage of the random_seed intrinsic
>> could be better.
>
>
> using /dev/urandom is very appealing!
>
> Your example shouldn't call "deallocate(seed)" after "call
> random_seed(put=seed)"?
>
> Something like this:
>
> ...
> end if
> call random_seed(put=seed)
> deallocate(seed)
>
> end subroutine rseed
> end module rseed_rand
Hi,
since seed is an allocatable array, it is automatically deallocated
when it goes out of scope, per the Fortran standard. IIRC this was one
of the relatively few changes in Fortran 95 compared to Fortran 90.
--
Janne Blomqvist
More information about the Fortran
mailing list