I am new to Fortran and I am trying to write a code using random data instead of binned data in x, y, z as shown in my sample code.

implicit real*8(a-h,o-z)
dimension rm(4),rp1(4),rip1(4),rp2(4),rip2(4),rp3(4),rip3(4),
d   rn(4),u1(4),u2(4),u3(4)

do ix= 1000,25000,1000
    x = ix/1000000.
    do iy = 1000,25000,1000
        y = iy/100000.
        do iz= 1,1000,25
            z = iz/10000.
            a = (x**2+y**2)/z
            b = x*y*z
            c = x*y**2+y*z**2+z*x**2
            fr = (a*b)/c
                write(40,*) x, y, x, fr
        end do
    end do
end do


How to convert such code having binned data to a code using random draws.

  • $\begingroup$ Why use Fortran these days? $\endgroup$ Commented Jan 20, 2021 at 16:42
  • $\begingroup$ Separately, please indent your code so that it is easier to read. $\endgroup$ Commented Jan 20, 2021 at 16:42
  • $\begingroup$ Your question reads more as a programming question than a computational science one. As such, it is off-topic in this site. $\endgroup$
    – nicoguaro
    Commented Jan 25, 2021 at 19:26


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.