# Fortran power station 4.0 problem

1. Jul 28, 2007

### tiantsai

i just doing a project about monte carlo simulation about the antiferromagnet particles system.My lecturer told ud to write a source code for a random number generator from 1-25 with the random number pick up cannot be repeated, i still very struggle...Anyone can help me solve the problem...the following is the source code that i write,"handicape" source code...thank you very much...

PROGRAM stastistics_mechanics
!
!Purpose:To calculate the Hamiltonian energy,partiton function,
! magnetization and heat capacity.
!
!Records of revisions.
!
! Date Programmer Change of Description
! ==== ========== =====================
! 27/07/2007 KOHPINWAI Original Code
!

USE MSIMSL

!Declare the parameters and dimension that are used in this program.
REAL,PARAMETER::J_ij=-2.0000 !The particle interaction constant for
! antiferromagnetic particles.
INTEGER,PARAMETER::max_size=25 !The rank 1 array size.

!Declare the variables that are used in this program.
REAL,DIMENSION(max_size)::value !The first rank array
REAL::S_1 !First particles spin
REAL::S_2 !Second particles spin
REAL::E_r !Energy spin of particles
INTEGER::i !The loop index
INTEGER::j

DO j=1,1
DO i=1,25
value(i)=25*RNUNF()
IF(i>6) THEN
S_1=1
ELSE
S_1=-1
END IF
WRITE(*,*)INT(value(i)),S_1
END DO
END DO

END PROGRAM

Actually is like need to form 1-25 number and in this number randomly pick up five but each of the number that you pick cannot be repeated...write a fortran program for this...any one can help me,i just figure almost six hour perday still can work...help me...thank you very much...

Last edited: Jul 28, 2007