Created
April 4, 2016 23:02
-
-
Save rsnemmen/879cb5452effcf2d20a8f0041b8724e4 to your computer and use it in GitHub Desktop.
Generates array of random numbers. Saves it as an unformatted Fortran 90 binary file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ! Generates arrays of random numbers. Saves them as binary | |
| ! unformatted files. | |
| program test | |
| implicit none | |
| real, dimension(:,:), allocatable :: y | |
| integer :: n | |
| character(len=50) :: out | |
| write(unit=*,fmt='(A,$)') 'Filename: ' | |
| read *, out | |
| write(unit=*,fmt='(A,$)') 'Number of points: ' | |
| read *, n | |
| ! allocated arrays | |
| allocate(y(n,n)) | |
| ! generates random numbers | |
| call random_number(y) | |
| OPEN(UNIT=1000,FILE=out,STATUS='REPLACE',form='unformatted') | |
| write(1000) y | |
| CLOSE(1000) | |
| !call writebin(10000,x,out) | |
| !call writebin(2,y,out) | |
| end program | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment