- #1
lth
- 4
- 0
Hello,
In VF, I am trying to fill a meshless grid with nodes from a random number generator. The value of the number is simply between 0 and 1. I am having trouble getting the RAND command in Fortran to change the random numbers through a loop. When I debug, the random number generated in each node is constant. I have looked at the help section for srand, random seed and am certain it has to do with the seed size [integer size, seed(2)] but cannot understand the syntax in help document under random numbers. Anyone see what i am doing wrong? Thank you, Lori
for example------here is the subprogram,
INCLUDE 'link_f90_dll.h'
USE IFPORT
USE LSARG_INT
IMPLICIT NONE
real(4) ranval
REAL(8), ALLOCATABLE :: X(:),Y(:)
INTEGER :: N
N=225
Allocate (X(N),Y(N))
!portion to define 1st 55 nodes of X(i) and Y(i)
!
CALL RANDOM_NUMBER (ranval)
do i=56,225
X(i) = 0.6*ranval
Y(i) = 1*ranval
enddo
In VF, I am trying to fill a meshless grid with nodes from a random number generator. The value of the number is simply between 0 and 1. I am having trouble getting the RAND command in Fortran to change the random numbers through a loop. When I debug, the random number generated in each node is constant. I have looked at the help section for srand, random seed and am certain it has to do with the seed size [integer size, seed(2)] but cannot understand the syntax in help document under random numbers. Anyone see what i am doing wrong? Thank you, Lori
for example------here is the subprogram,
INCLUDE 'link_f90_dll.h'
USE IFPORT
USE LSARG_INT
IMPLICIT NONE
real(4) ranval
REAL(8), ALLOCATABLE :: X(:),Y(:)
INTEGER :: N
N=225
Allocate (X(N),Y(N))
!portion to define 1st 55 nodes of X(i) and Y(i)
!
CALL RANDOM_NUMBER (ranval)
do i=56,225
X(i) = 0.6*ranval
Y(i) = 1*ranval
enddo