Random seed initialization
Angelo Graziosi
angelo.graziosi@alice.it
Sat Apr 6 15:44:00 GMT 2013
Il 06/04/2013 17.31, Angelo Graziosi ha scritto:
>
> Using my build of GCC-4.9.0 20130324, each run produces always this
>
> $ ./rnd_init.out
> n= 12
> clock: 0
> seed: 0 37 74 111 148
> 185 222 259 296 333 370
> 407
> random: 0.301754534 0.380439878 0.926293135
> 0.672118008 0.237815678 0.638214409 0.320253670
> 0.351599574 0.865273237
NOT if I use integer(8) for clock! i.e.,
-INTEGER :: i, n, clock
+INTEGER :: i, n
+integer(8) :: clock
$ ./rnd_init.out
n= 12
clock: 2514
seed: 2514 2551 2588 2625 2662
2699 2736 2773 2810 2847 2884
2921
random: 0.856471837 0.646582901 0.842527211
0.408018589 0.119095922 0.472753406 0.178733706
0.310193837 0.975207925
$ ./rnd_init.out
n= 12
clock: 3073
seed: 3073 3110 3147 3184 3221
3258 3295 3332 3369 3406 3443
3480
random: 0.755927980 0.275160611 0.695910215
0.892024457 0.765848935 0.806375623 0.854564309
0.476479411 0.671030104
$ ./rnd_init.out
n= 12
clock: 2793
seed: 2793 2830 2867 2904 2941
2978 3015 3052 3089 3126 3163
3200
random: 0.176801622 0.477179229 0.347330809
0.931735039 0.397000909 0.298735499 0.286392748
0.723265111 0.366750956
etc..
> Ciao,
> Angelo.
>
More information about the Fortran
mailing list