Quantcast
Channel: Intel® Software - Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2746

Expected Behavior for random_number() with Improper SEED array

$
0
0

What would be the expected behavior of random_seed and/or random_number if one were to pass as an array argument to random_seed a variable initialized as an array of size < N, where N is the value of the integer returned from executing random_seed with SIZE?  Specifically, for v16.0.1 of IFC if the behavior has changed over time.  Below is a snippet of code to illustrate the point, pardon any syntax errors:

program main

implicit none

integer :: i

integer, allocatable, dimension(:) :: x

real :: y

call random_seed(SIZE=i)

write(*,*) 'Seed array size = ', i

***Assume the above writes 'Seed array size = 2' to STDOUT.***

allocate(x(1))

x = 38433

call random_seed(PUT=x)

call random_number(y)

end program main


Viewing all articles
Browse latest Browse all 2746

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>