请问在fortran中如何生成(0~1)之间的随机数?最好是生成一个数组L(1:1000),其中随机50个元素为1,其它都为0,
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 22:43:17
请问在fortran中如何生成(0~1)之间的随机数?最好是生成一个数组L(1:1000),其中随机50个元素为1,其它都为0,
请问在fortran中如何生成(0~1)之间的随机数?
最好是生成一个数组L(1:1000),其中随机50个元素为1,其它都为0,
请问在fortran中如何生成(0~1)之间的随机数?最好是生成一个数组L(1:1000),其中随机50个元素为1,其它都为0,
SEED
Run-Time Subroutine:Changes the starting point of the pseudorandom number generator.
Module:USE DFLIB
Syntax
CALL SEED (iseed)
iseed
(Input) INTEGER(4).Starting point for RANDOM.
SEED uses iseed to establish the starting point of the pseudorandom number generator.A given seed always produces the same sequence of values from RANDOM.
If SEED is not called before the first call to RANDOM,RANDOM always begins with a seed value of one.If a program must have a different pseudorandom sequence each time it runs,pass the constant RND$TIMESEED (defined in DFLIB.F90 in the \DF98\INCLUDE subdirectory) to the SEED routine before the first call to RANDOM.