<?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 Numbers and Buildings in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Random-Numbers-and-Buildings/m-p/1691601#M175875</link>
    <description>&lt;P&gt;If you run Gardners genetic algorithm with Fortran and any RNG it always fails on the ones I have tested.&lt;/P&gt;&lt;P&gt;BASICA however does not fail, I just do not know the form of their RNG.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 21 May 2025 20:26:02 GMT</pubDate>
    <dc:creator>JohnNichols</dc:creator>
    <dc:date>2025-05-21T20:26:02Z</dc:date>
    <item>
      <title>Random Numbers and Buildings</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Random-Numbers-and-Buildings/m-p/1690461#M175833</link>
      <description>&lt;P&gt;There is a nice set of&amp;nbsp;Daubechies wavelets coded in old Fortran by&amp;nbsp;John Burkardt from Pittsburg.&amp;nbsp; I have a building that is shaking itself to pieces slowly, but surely. I was thinking of looking at the various acceleration signals from the building using these wavelets.&amp;nbsp; A blasted long shot I am sure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I enclose a zip of the code changed to F90.&amp;nbsp; I started with a 1600 long random set with D2.&amp;nbsp; The issue is firstly the input, as shown in the figure generated using the code random method.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SI1.png" style="width: 999px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/65779iED37DFB8931788BF/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="SI1.png" alt="SI1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The mean is 0.496, the stdev is 0.289,&amp;nbsp; &amp;nbsp;0.5/0.289 is 1.73 so it is a truncated Gaussian, the skew is 0.00176 and the kurt is -1.17&amp;nbsp;&lt;/P&gt;&lt;P&gt;For instance, the uniform distribution (i.e. one that is uniformly finite over some bound and zero elsewhere) is platykurtic. As this one is.&amp;nbsp;&lt;/P&gt;&lt;P&gt;And if I look at the first 50 numbers as a graph it is clearly a simple Fourier series.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code for the RNG, it is clearly not really random.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;!*********************************************************************72
!
! R8VEC_UNIFORM_01 returns a unit pseudorandom R8VEC.
!
!  Discussion:
!
!    An R8VEC is a vector of R8's.
!
!
!  Reference:
!
!    Paul Bratley, Bennett Fox, Linus Schrage,
!    A Guide to Simulation,
!    Springer Verlag, pages 201-202, 1983.
!
!    Bennett Fox,
!    Algorithm 647:
!    Implementation and Relative Efficiency of Quasirandom
!    Sequence Generators,
!    ACM Transactions on Mathematical Software,
!    Volume 12, Number 4, pages 362-376, 1986.
!
!    Peter Lewis, Allen Goodman, James Miller,
!    A Pseudo-Random Number Generator for the System/360,
!    IBM Systems Journal,
!    Volume 8, pages 136-143, 1969.
!
!  Parameters:
!
!    Input, integer N, the number of entries in the vector.
!
!    Input/output, integer SEED, the "seed" value, which should NOT be 0.
!    On output, SEED has been updated.
!
!    Output, double precision R(N), the vector of pseudorandom values.
!
      implicit none

      integer n

      integer i
      integer k
      integer seed
      double precision r(n)

      do i = 1, n

        k = seed / 127773

        seed = 16807 * ( seed - k * 127773 ) - k * 2836

        if ( seed .lt. 0 ) then
          seed = seed + 2147483647
        end if

        r(i) = dble ( seed ) * 4.656612875D-10

      end do

      return
      end&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohnNichols_0-1747422600907.png" style="width: 593px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/65780i87FAE836FC14116E/image-dimensions/593x135/is-moderation-mode/true?v=v2&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" width="593" height="135" role="button" title="JohnNichols_0-1747422600907.png" alt="JohnNichols_0-1747422600907.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;A Fourier series is not a random set, it cannot be, even if you pass the random number test.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/41971"&gt;@mecej4&lt;/a&gt;&amp;nbsp; or&amp;nbsp;@jimdempseythecove or one of the other gurus, please tell me why I am wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the D2 results.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohnNichols_1-1747422808202.png" style="width: 653px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/65781i69A684CCE0D701CD/image-dimensions/653x293/is-moderation-mode/true?v=v2&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" width="653" height="293" role="button" title="JohnNichols_1-1747422808202.png" alt="JohnNichols_1-1747422808202.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I can change to the MKL randoms, but I cannot see that the result over a bounded width willnot be the same,&amp;nbsp; I will always have a&amp;nbsp;platykurtic. distribution as we do from the acceleration data and FFT's for some components.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2025 19:21:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Random-Numbers-and-Buildings/m-p/1690461#M175833</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2025-05-16T19:21:09Z</dc:date>
    </item>
    <item>
      <title>Re: Random Numbers and Buildings</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Random-Numbers-and-Buildings/m-p/1690552#M175838</link>
      <description>&lt;P&gt;You see, one goes along for years on this forum, and the same people provide the guiding light for a poor programmer.&amp;nbsp; And then they just go quiet.&amp;nbsp; Even though you have never met them, it leaves a hole in your soul.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;The problem with using Fortran as a RNG is that the language has strict structure, it is designed to solve engineering problems, not generate RNGs.&amp;nbsp; It repeats in RNG's, there is always a repeat, this has plagued Fortran for the last 80 years.&amp;nbsp; Basica always had a better built in random number generator, one only has to look at the most basic Genetic Algorithm from the SciAmer in the 1980's to see that.&lt;/P&gt;&lt;P&gt;A real RNG from nature is thermal or similar,&amp;nbsp; in the picture everything up to 2.5 Hz is purely random and Gaussian, you cannot get any information on the underlying structure, which is what you want in an RNG, but above that we can determine structure and hence it is not a RNG generator.&amp;nbsp; The thermal line in the FFT data is always the same shape up to a point of structural interaction.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Histogram-Z-FFT-LOG.png" style="width: 877px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/65797i27109192649EDF38/image-dimensions/877x526/is-moderation-mode/true?v=v2&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" width="877" height="526" role="button" title="Histogram-Z-FFT-LOG.png" alt="Histogram-Z-FFT-LOG.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I realize this is not about the Intel Fortran, but an underlying issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 May 2025 12:03:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Random-Numbers-and-Buildings/m-p/1690552#M175838</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2025-05-17T12:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: Random Numbers and Buildings</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Random-Numbers-and-Buildings/m-p/1691570#M175873</link>
      <description>&lt;P&gt;John,&lt;/P&gt;&lt;P&gt;If you are going to roll your own RNG, try something along the lines of this:&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;program Prime
    implicit none
    integer(8) :: seed = 0, i8temp
    integer(8), parameter :: largeCircularPrime = 999331_8, mask=Z'FFFFFFFF'
    integer, parameter :: n=10000
    real(8) r(n), rTemp, rDivisor
    integer :: i
    rDivisor = mask + 1
    do i=1,n
        if(seed == 0) seed = 1
        seed = seed * largeCircularPrime
        i8temp = iand(ishft(seed, 16), mask) ! random number between 2^32-1 and 0
        rTemp = real(i8temp,8)
        r(i) = rTemp / rDivisor ! r(i) &amp;gt;= 0, r(i) &amp;lt; 1.0
    end do
end program Prime&lt;/LI-CODE&gt;&lt;P&gt;Note, the above written for clarity of understanding not performance. You can choose a different largeCircular prime and/or change the mask width (with appropriate ishft bits).&amp;nbsp; IOW the above produces pseudo random numbers of 32 bits of precision.&lt;/P&gt;&lt;P&gt;To get more (say 48 bits), widen the mask by 16 bits and reduce the shift by 8 bits.&lt;/P&gt;&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Wed, 21 May 2025 17:26:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Random-Numbers-and-Buildings/m-p/1691570#M175873</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2025-05-21T17:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: Random Numbers and Buildings</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Random-Numbers-and-Buildings/m-p/1691600#M175874</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohnNichols_0-1747858638937.png" style="width: 642px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/65956i91A152BB9B2821B5/image-dimensions/642x387/is-moderation-mode/true?v=v2&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" width="642" height="387" role="button" title="JohnNichols_0-1747858638937.png" alt="JohnNichols_0-1747858638937.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Your method has an underlying structure that repeats, the lines should all be along the bottom as a solid block, the popups are the repeats, this is in 4096 numbers, that may appear random but are not.&amp;nbsp; If you use this series looking for a Monte Carlo Analysis you will run into problems with the structure.&amp;nbsp; First 26 points show the structure.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohnNichols_1-1747858809354.png" style="width: 662px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/65957iC9EB06E643805336/image-dimensions/662x399/is-moderation-mode/true?v=v2&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" width="662" height="399" role="button" title="JohnNichols_1-1747858809354.png" alt="JohnNichols_1-1747858809354.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If I measure a vibrating string and I get a non mode frequency &amp;lt; 1 or 2 depending on your luck, you have a random Gaussian, if the vibration is from the sun.&amp;nbsp; If you have an underlying math structure I can find the pattern.&amp;nbsp; It looks random, it may even pass a so called random test, but it is not truly random.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 May 2025 20:23:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Random-Numbers-and-Buildings/m-p/1691600#M175874</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2025-05-21T20:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Random Numbers and Buildings</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Random-Numbers-and-Buildings/m-p/1691601#M175875</link>
      <description>&lt;P&gt;If you run Gardners genetic algorithm with Fortran and any RNG it always fails on the ones I have tested.&lt;/P&gt;&lt;P&gt;BASICA however does not fail, I just do not know the form of their RNG.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 May 2025 20:26:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Random-Numbers-and-Buildings/m-p/1691601#M175875</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2025-05-21T20:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: Random Numbers and Buildings</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Random-Numbers-and-Buildings/m-p/1691801#M175877</link>
      <description>&lt;P&gt;&amp;gt;&amp;gt;&lt;SPAN&gt;&amp;nbsp;the popups are the repeats, this is in 4096 numbers&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks. This would warrant investigation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What did you use to chart the pop-ups?&lt;/P&gt;&lt;P&gt;This may be due to bad choice of multiplier 999331, can you try a non-circular prime number.&lt;/P&gt;&lt;P&gt;Here is a list of &lt;EM&gt;different types&lt;/EM&gt; of prime numbers:&lt;/P&gt;&lt;P&gt;&lt;A href="https://en.wikipedia.org/wiki/List_of_prime_numbers" target="_blank"&gt;https://en.wikipedia.org/wiki/List_of_prime_numbers&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Try a balanced prime first. (e.g.&amp;nbsp;5387)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Thu, 22 May 2025 12:02:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Random-Numbers-and-Buildings/m-p/1691801#M175877</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2025-05-22T12:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: Random Numbers and Buildings</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Random-Numbers-and-Buildings/m-p/1691835#M175885</link>
      <description>&lt;P&gt;The plotting is on EXCEL, for simple stuff it is easier.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem is I look for patterns in data.&amp;nbsp; Random is never random.&lt;/P&gt;&lt;P&gt;So your system gives a usable set of a Monte Carlo analysis, but it is a long way from truly random.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I take a bridge I have, it has a theoretical lowest frequency of 3 Hz, we find that nicely if we listen for an hour.&amp;nbsp; &amp;nbsp;Non Gaussian in a Gaussian stream.&lt;/P&gt;&lt;P&gt;After three years of listening, I found it had a frequency of 1 Hz, that occurred 10 times in 3 million records.&amp;nbsp; &amp;nbsp;If I pull out those ten records the 1 Hz data is Gaussian Random, but once a month it is non Gaussian.&amp;nbsp; &amp;nbsp;10 in 3 million is a low probability but for my stuff it matters.&amp;nbsp; We now know we have low frequencies that are hard to find.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A prime number generator is a set of circular steps,&amp;nbsp; anyone who says Prime numbers are random, really does not understand the relationship between the primes and the integer number line.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Think of this number system&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10&lt;/P&gt;&lt;P&gt;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;100&lt;/P&gt;&lt;P&gt;7&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1000&lt;/P&gt;&lt;P&gt;11&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10000&lt;/P&gt;&lt;P&gt;So an composite number can come from the second list 1, 10, 100 etc. it is just a weird multiplication, one could say the next prime is 100000 and it is simple to find.&amp;nbsp;&lt;/P&gt;&lt;P&gt;so remove all factors of 2, then 3 pops up, remove all factors of 3 and 6 etc. this goes all the way.&amp;nbsp; There should be a representation system that is not the integer number line that makes it easy.&amp;nbsp; &amp;nbsp;So 49 is just 2000, 9 is 20 etc. , 6 is just 11 and 25 is 200&lt;/P&gt;</description>
      <pubDate>Thu, 22 May 2025 17:00:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Random-Numbers-and-Buildings/m-p/1691835#M175885</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2025-05-22T17:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: Random Numbers and Buildings</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Random-Numbers-and-Buildings/m-p/1691836#M175886</link>
      <description>&lt;P&gt;This simple set proves the primes are infinite, but they get further apart in a non random way.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 May 2025 17:02:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Random-Numbers-and-Buildings/m-p/1691836#M175886</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2025-05-22T17:02:51Z</dc:date>
    </item>
  </channel>
</rss>

