Vector of n components [closed]

1

I tried to build a program that generates a vector of 1000 components, but then it does not do anything. The code is this, very simple:

program vector

    real:: r(10000)
    call random_number(r)

end program
    
asked by Joaquin 06.02.2017 в 16:39
source

1 answer

0

This does not try to be an answer since your question does not specify what you expect the program to do ... but this content neither enters a comment nor is it readable.

The program works and does exactly what it is asked for ... an example:

program vector

    real:: r(5)
    print *,r
    call random_number(r)
    print *,r

end program

This program generates, in my case, the following output:

0.00000000E+00   0.00000000E+00   0.00000000E+00   0.00000000E+00   2.64840121E+22   
0.997559547      0.566824675      0.965915322      0.747927666      0.367390871  

There you see how the values of the vector have changed after the call to random_number .

I do not know what you expect the program to do, but for now your job of generating pseudo-random numbers works.

By the way, consider establishing an initial seed to avoid cyclical sequences.

    
answered by 06.02.2017 в 16:52