Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

fortran random number generator

Status
Not open for further replies.

mikibelavista

Technical User
Jan 18, 2012
32
I am translating some code form matlab to fortran90,I need to generate random numbers for matrix.
This is how MATLAB code looks like,and gives me the same values all the time.
rand('state',0)
v = 2*(ones(c,1)*aa).*(rand(c,n)-0.5) + ones(c,1)*mm;
Is there any idea how to solve this in FORTRAN?
 
There are basically two routines: RANDOM_SEED and RANDOM_NUMBER. RANDOM_SEED sets the seed so you can get the same sequence every time. RANDOM_NUMBER generates the number. There are lots of examples of how to use them on the net.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top