<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Random number in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Random-number/m-p/962329#M22091</link>
    <description>Call RANDOM_SEED with no arguments at the start of your main program.  The initializes the seed of the RANDOM_NUMBER subroutine with a value taken from the RTC, I think.  If you don't execute the program back to back with less time between invocations than the granularity of the RTC (1 second?) you will get a different set of values from RANDOM_NUMBER each time the program runs.</description>
    <pubDate>Mon, 13 Aug 2001 07:33:06 GMT</pubDate>
    <dc:creator>Intel_C_Intel</dc:creator>
    <dc:date>2001-08-13T07:33:06Z</dc:date>
    <item>
      <title>Random number</title>
      <link>https://community.intel.com/t5/Software-Archive/Random-number/m-p/962328#M22090</link>
      <description>Can anyone tell me how to get a  random number that is different each time when the routine is excuted?</description>
      <pubDate>Mon, 13 Aug 2001 07:04:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Random-number/m-p/962328#M22090</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-08-13T07:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: Random number</title>
      <link>https://community.intel.com/t5/Software-Archive/Random-number/m-p/962329#M22091</link>
      <description>Call RANDOM_SEED with no arguments at the start of your main program.  The initializes the seed of the RANDOM_NUMBER subroutine with a value taken from the RTC, I think.  If you don't execute the program back to back with less time between invocations than the granularity of the RTC (1 second?) you will get a different set of values from RANDOM_NUMBER each time the program runs.</description>
      <pubDate>Mon, 13 Aug 2001 07:33:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Random-number/m-p/962329#M22091</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-08-13T07:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Random number</title>
      <link>https://community.intel.com/t5/Software-Archive/Random-number/m-p/962330#M22092</link>
      <description>James is correct, as it applies to Compaq Fortran, but I will caution you that this behavior (randomizing the seed based on the clock) is not specified by the standard.  All the standard says is that a call to RANDOM_SEED with no arguments sets the seed to an implementation-defined value.  It &lt;B&gt;could&lt;/B&gt; be the same value run to run (and in fact was, in our initial implementation.)&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Mon, 13 Aug 2001 08:43:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Random-number/m-p/962330#M22092</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2001-08-13T08:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Random number</title>
      <link>https://community.intel.com/t5/Software-Archive/Random-number/m-p/962331#M22093</link>
      <description>James and Steve: &lt;BR /&gt; &lt;BR /&gt;Thank you very much for your replies.  Indeed, my question is how to generate a set of random numbers, say m random numbers,  between 1 and N.  Here m and N are integers and m &amp;lt;= N.</description>
      <pubDate>Tue, 14 Aug 2001 08:25:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Random-number/m-p/962331#M22093</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-08-14T08:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Random number</title>
      <link>https://community.intel.com/t5/Software-Archive/Random-number/m-p/962332#M22094</link>
      <description>&lt;PRE&gt;&lt;FONT size="+0"&gt; 
module all_my_functions 
   implicit none 
   contains 
      subroutine sub 
         integer m 
         integer N 
         integer, allocatable :: ran_ints(:) 
         real, allocatable :: harvest(:) 
         character(20) fmt 
 
! Get the number of random numbers 
         write(*,'(a)',advance='no') 'How many random numbers do you want:&amp;gt; ' 
         read(*,*) m 
! Get the range of random numbers 
         write(*,'(a)',advance='no') 'What should their maximum value be:&amp;gt; ' 
         read(*,*) N 
! Make the arrays big enough 
         allocate(ran_ints(m),harvest(m)) 
! Create random real array 
         call random_number(harvest) 
! Create random integer array 
         ran_ints = harvest*N+1 ! Needs at least CVF 6.5 to work 
! Write out results 
         write(fmt,'(a,i0,a)') '(',m,'(i0:1x))' 
         write(*,fmt) ran_ints 
         return 
      end subroutine sub 
end module all_my_functions 
 
program ran_test 
   use all_my_functions 
   implicit none 
   character(1) response 
   character(6) :: again = '' 
 
! Put this call once in the main program; you shouldn't call 
! random_seed again in the program 
   call random_seed() 
 
! Loop while the user wants to test the subroutine 
   response_loop: do 
      write(*,'(a)',advance='no') 'Do you want to run the test' 
      write(*,'(a)',advance='no') trim(again)//' [y|n]:&amp;gt; ' 
      read(*,'(a1)') response 
      select case(response) 
         case('y','Y') 
            call sub 
            again = ' again' 
         case('n','N') 
            exit response_loop 
         case default 
            write(*,'(a)') "Your response, '"//response//"', was invalid" 
            write(*,'(a)') "Please enter 'y' or 'n' at the prompt" 
      end select 
   end do response_loop 
end program ran_test 
&lt;/FONT&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Aug 2001 12:05:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Random-number/m-p/962332#M22094</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-08-14T12:05:30Z</dc:date>
    </item>
  </channel>
</rss>

