View Single Post
Old Feb 11th, 2008, 4:18 PM   #4
lizi_n
Newbie
 
Join Date: Feb 2008
Posts: 3
Rep Power: 0 lizi_n is on a distinguished road
Re: random numbers fortran 90

This is what I've got so far if it helps.

integer:: n
parameter(n=10)

integer:: i,t,h
real:: s
integer, dimension(n) :: x

do i=1,n/2
x(i)=1
end do

do i=n/2+1,n
x(i)=-1
end do

print '(10i2)',x

do i=1,n

call random_number(s)
s=n*s

do h=0,n-1
if(s.gt.h.and.s.lt.h+1) t=h+1
end do


x(i)=x(t)
x(t)=x(i)

print*,x(i)


end do
lizi_n is offline   Reply With Quote