作业帮 > 综合 > 作业

请问在fortran中如何生成(0~1)之间的随机数?

来源:学生作业帮 编辑:搜搜做题作业网作业帮 分类:综合作业 时间:2024/06/29 00:26:20
请问在fortran中如何生成(0~1)之间的随机数?
最好是生成一个数组L(1:1000),其中随机50个元素为1,其它都为0,
请问在fortran中如何生成(0~1)之间的随机数?
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.