Function Overloading

Steve Lionel (Intel)
Total Points:
115,145
Status Points:
115,145
Black Belt
July 3, 2009 6:06 PM PDT
Rate
 
|Best Answer
#3 Reply to #2
This is how it's done.  Note that geneSize is not defined here, but I assume you'll take care of that.

MODULE test
USE IFPORT

INTERFACE getRandom
MODULE PROCEDURE getRandomA
MODULE PROCEDURE getRandomB
MODULE PROCEDURE getRandomC
END INTERFACE

CONTAINS
INTEGER FUNCTION getRandomA()
IMPLICIT NONE
getRandomA = MOD( IRAND(), geneSize-1 ) + 1 !        GENERATE RANDOM FROM 1 TO geneSize-1
END FUNCTION

INTEGER FUNCTION getRandomB(max)
IMPLICIT NONE
INTEGER, INTENT(IN) :: max
getRandomB = MOD( IRAND(), geneSize-1 ) + 1 !        GENERATE RANDOM FROM 1 TO geneSize-1
END FUNCTION

INTEGER FUNCTION getRandomC(min, max)
IMPLICIT NONE
INTEGER, INTENT(IN) :: min, max
getRandomC = MOD( IRAND(), geneSize-1 ) + 1 !        GENERATE RANDOM FROM 1 TO geneSize-1
END FUNCTION
END MODULE





Intel Software Network Forums Statistics

8484 users have contributed to 31619 threads and 100691 posts to date.
In the past 24 hours, we have 34 new thread(s) 123 new posts(s), and 181 new user(s).

In the past 3 days, the most popular thread for everyone has been gemm(A,A,A) like possible? The most posts were made to gemm(A,A,A) like possible? The post with the most views is Dear Steve, excuse me for a d

Please welcome our newest member monkeybrains