<?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: Using VSL to generate uniformly distributed random doubles in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-VSL-to-generate-uniformly-distributed-random-doubles/m-p/908659#M11940</link>
    <description>&lt;P&gt;Time which passes between creation/initialization of stream1 and stream2is expected to be much less than 1 sec. So,two calls to time() routine in the program return the same number of seconds, both streamsare initialized with the same seed and their outputs are identical from run to run.If you stop your program before creation of the second stream for 1 second, seed used for initialization of stream2 will be another, and its output willdifferent. Also, to make sure that you obtain new number x from run to run of your program you need to print moredigits after the point.&lt;/P&gt;
&lt;P&gt;Initialization of MCG31m1 generator is made in the following way: x0 = seed mod 2^31-1 (if x0=0 thenx0 is set to 1). So, if value which is returned by the function time() is greater than 2^31-1corresponding remainder will be chosen for initialization of the first element of random sequence.Currently,output of thefunction time() isless than 2^31-1, andnumber of seconds returned by the function is directly usedin calculation of the first random number. More detailed information about initialization of MCG31m1can be found in Vslnotes.pdf (&lt;A href="http://www.intel.com/software/products/mkl/docs/vslnotes.pdf"&gt;http://www.intel.com/software/products/mkl/docs/vslnotes.pdf&lt;/A&gt;).&lt;/P&gt;</description>
    <pubDate>Fri, 29 Sep 2006 15:56:41 GMT</pubDate>
    <dc:creator>Andrey_N_Intel</dc:creator>
    <dc:date>2006-09-29T15:56:41Z</dc:date>
    <item>
      <title>Using VSL to generate uniformly distributed random doubles</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-VSL-to-generate-uniformly-distributed-random-doubles/m-p/908655#M11936</link>
      <description>&lt;P&gt;I have the following code:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;FONT color="#0000ff" size="2"&gt;
&lt;P&gt;int&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; nrand = 1;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;double&lt;/FONT&gt;&lt;FONT size="2"&gt; *x = &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;new&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;double&lt;/FONT&gt;&lt;FONT size="2"&gt;[nrand];&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;double&lt;/FONT&gt;&lt;FONT size="2"&gt; *y = &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;new&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;double&lt;/FONT&gt;&lt;FONT size="2"&gt;[nrand];&lt;P&gt;&lt;/P&gt;
&lt;P&gt;VSLStreamStatePtr stream1;&lt;/P&gt;
&lt;P&gt;vslNewStream(&amp;amp;stream1, VSL_BRNG_MCG31, &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;static_cast&lt;/FONT&gt;&lt;FONT size="2"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;unsigned&lt;/FONT&gt;&lt;FONT size="2"&gt;&amp;gt;(time(NULL)));&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;vdRngUniform(VSL_METHOD_DUNIFORM_STD, stream1, nrand, x, 0, 1);&lt;/P&gt;
&lt;P&gt;VSLStreamStatePtr stream2;&lt;/P&gt;
&lt;P&gt;vslNewStream(&amp;amp;stream2, VSL_BRNG_MCG31, &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;static_cast&lt;/FONT&gt;&lt;FONT size="2"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;unsigned&lt;/FONT&gt;&lt;FONT size="2"&gt;&amp;gt;(time(NULL)));&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;vdRngUniform(VSL_METHOD_DUNIFORM_STD, stream2, nrand, y, 0, 1);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;I keep getting the same generated values for xand yevery time. What am I doing wrong?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;~Nafis&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;</description>
      <pubDate>Thu, 28 Sep 2006 17:27:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-VSL-to-generate-uniformly-distributed-random-doubles/m-p/908655#M11936</guid>
      <dc:creator>nupshur</dc:creator>
      <dc:date>2006-09-28T17:27:14Z</dc:date>
    </item>
    <item>
      <title>Re: Using VSL to generate uniformly distributed random doubles</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-VSL-to-generate-uniformly-distributed-random-doubles/m-p/908656#M11937</link>
      <description>&lt;P&gt;Thank you for your question. In both cases you initialize random streams with the same seed and obtain identical outputs.You may check this printing out the values returned by the time() function. If you suspend your program for at least 1 sec you will be able toobserve difference in outputs of the generator.&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2006 18:32:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-VSL-to-generate-uniformly-distributed-random-doubles/m-p/908656#M11937</guid>
      <dc:creator>Andrey_N_Intel</dc:creator>
      <dc:date>2006-09-28T18:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using VSL to generate uniformly distributed random doubles</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-VSL-to-generate-uniformly-distributed-random-doubles/m-p/908657#M11938</link>
      <description>&lt;P&gt;Right, but the same values are always generated from run to run (i.e.I keep getting the same value for x every time).Why is that?&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;~Nafis&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2006 06:39:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-VSL-to-generate-uniformly-distributed-random-doubles/m-p/908657#M11938</guid>
      <dc:creator>nupshur</dc:creator>
      <dc:date>2006-09-29T06:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: Using VSL to generate uniformly distributed random doubles</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-VSL-to-generate-uniformly-distributed-random-doubles/m-p/908658#M11939</link>
      <description>&lt;P&gt;Yes, there are different ways of choosing the seed that produce better results, but what's wrong with simply using time(NULL)? Does the particular BRNG I'm using not produce varying results for very large unsigned seed values?&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;~Nafis&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2006 12:22:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-VSL-to-generate-uniformly-distributed-random-doubles/m-p/908658#M11939</guid>
      <dc:creator>nupshur</dc:creator>
      <dc:date>2006-09-29T12:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using VSL to generate uniformly distributed random doubles</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-VSL-to-generate-uniformly-distributed-random-doubles/m-p/908659#M11940</link>
      <description>&lt;P&gt;Time which passes between creation/initialization of stream1 and stream2is expected to be much less than 1 sec. So,two calls to time() routine in the program return the same number of seconds, both streamsare initialized with the same seed and their outputs are identical from run to run.If you stop your program before creation of the second stream for 1 second, seed used for initialization of stream2 will be another, and its output willdifferent. Also, to make sure that you obtain new number x from run to run of your program you need to print moredigits after the point.&lt;/P&gt;
&lt;P&gt;Initialization of MCG31m1 generator is made in the following way: x0 = seed mod 2^31-1 (if x0=0 thenx0 is set to 1). So, if value which is returned by the function time() is greater than 2^31-1corresponding remainder will be chosen for initialization of the first element of random sequence.Currently,output of thefunction time() isless than 2^31-1, andnumber of seconds returned by the function is directly usedin calculation of the first random number. More detailed information about initialization of MCG31m1can be found in Vslnotes.pdf (&lt;A href="http://www.intel.com/software/products/mkl/docs/vslnotes.pdf"&gt;http://www.intel.com/software/products/mkl/docs/vslnotes.pdf&lt;/A&gt;).&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2006 15:56:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-VSL-to-generate-uniformly-distributed-random-doubles/m-p/908659#M11940</guid>
      <dc:creator>Andrey_N_Intel</dc:creator>
      <dc:date>2006-09-29T15:56:41Z</dc:date>
    </item>
  </channel>
</rss>

