<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, Using random numbers</title>
    <link>http://www.mapleprimes.com/questions/137189-Using-Random-Numbers</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Tue, 09 Jun 2026 20:59:32 GMT</lastBuildDate>
    <pubDate>Tue, 09 Jun 2026 20:59:32 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, Using random numbers</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, Using random numbers</title>
      <link>http://www.mapleprimes.com/questions/137189-Using-Random-Numbers</link>
    </image>
    <item>
      <title>Are they calculated equally fast?</title>
      <link>http://www.mapleprimes.com/questions/137189-Using-Random-Numbers?ref=Feed:MaplePrimes:Using random numbers:Comments#answer137191</link>
      <itunes:summary>&lt;p&gt;You can determine the speed difference yourself, to see which is better, based on how many values you need to calculate.&amp;nbsp; I ran both of your code segement twice.&amp;nbsp; The time difference will vary based on machine speed and memory.&amp;nbsp; For small values of i, &amp;lt;100000, the time difference between the two versions is not noticeable.&lt;/p&gt;
&lt;!--break--&gt;&lt;form name="worksheet_form"&gt;
&lt;table style="width: 576px;" align="center"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;restart:st := time():&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;for i from 1 by 1 to 5000000 do&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;randomize():&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;rand()/(1000000000000.);&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;end do:&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;time() - st;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;img style="vertical-align: -6;" src="/view.aspx?sf=137191/442502/0b1646f52ebf76d8dc62340690130555.gif" alt="98.485" width="47" height="23"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;(1)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;restart:with(RandomTools[MersenneTwister]):st := time():&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;for i from 1 by 1 to 5000000 do&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;randomize():&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;GenerateFloat();&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;end do:&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;time() - st;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;img style="vertical-align: -6;" src="/view.aspx?sf=137191/442502/b2fc51c15396e7eca180627f871acc6e.gif" alt="81.640" width="47" height="23"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;(2)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;restart:st := time():&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;for i from 1 by 1 to 5000000 do&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;randomize():&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;rand()/(1000000000000.);&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;end do:&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;time() - st;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;img style="vertical-align: -6;" src="/view.aspx?sf=137191/442502/d07d3043259045ff0a5cbd68aff95143.gif" alt="97.234" width="47" height="23"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;(3)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;restart:with(RandomTools[MersenneTwister]):st := time():&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;for i from 1 by 1 to 5000000 do&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;randomize():&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;GenerateFloat();&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;end do:&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;time() - st;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;img style="vertical-align: -6;" src="/view.aspx?sf=137191/442502/8bf1d08a3dfc3227346566dcffc5d6b1.gif" alt="83.578" width="47" height="23"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;(4)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;input type="hidden" name="sequence" value="1"&gt;&lt;input type="hidden" name="cmd" value="none"&gt;&lt;/form&gt;
&lt;p&gt;&lt;a href="/view.aspx?sf=137191/442502/randtime.mw"&gt;Download randtime.mw&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Georgios Kokovidis&lt;/p&gt;
&lt;p&gt;Dr&amp;auml;ger Medical&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;You can determine the speed difference yourself, to see which is better, based on how many values you need to calculate.&amp;nbsp; I ran both of your code segement twice.&amp;nbsp; The time difference will vary based on machine speed and memory.&amp;nbsp; For small values of i, &amp;lt;100000, the time difference between the two versions is not noticeable.&lt;/p&gt;
&lt;!--break--&gt;&lt;form name="worksheet_form"&gt;
&lt;table style="width: 576px;" align="center"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;restart:st := time():&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;for i from 1 by 1 to 5000000 do&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;randomize():&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;rand()/(1000000000000.);&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;end do:&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;time() - st;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;img style="vertical-align: -6;" src="/view.aspx?sf=137191/442502/0b1646f52ebf76d8dc62340690130555.gif" alt="98.485" width="47" height="23"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;(1)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;restart:with(RandomTools[MersenneTwister]):st := time():&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;for i from 1 by 1 to 5000000 do&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;randomize():&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;GenerateFloat();&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;end do:&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;time() - st;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;img style="vertical-align: -6;" src="/view.aspx?sf=137191/442502/b2fc51c15396e7eca180627f871acc6e.gif" alt="81.640" width="47" height="23"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;(2)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;restart:st := time():&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;for i from 1 by 1 to 5000000 do&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;randomize():&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;rand()/(1000000000000.);&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;end do:&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;time() - st;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;img style="vertical-align: -6;" src="/view.aspx?sf=137191/442502/d07d3043259045ff0a5cbd68aff95143.gif" alt="97.234" width="47" height="23"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;(3)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;restart:with(RandomTools[MersenneTwister]):st := time():&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;for i from 1 by 1 to 5000000 do&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;randomize():&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;GenerateFloat();&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;end do:&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;time() - st;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;img style="vertical-align: -6;" src="/view.aspx?sf=137191/442502/8bf1d08a3dfc3227346566dcffc5d6b1.gif" alt="83.578" width="47" height="23"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;(4)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;input type="hidden" name="sequence" value="1"&gt;&lt;input type="hidden" name="cmd" value="none"&gt;&lt;/form&gt;
&lt;p&gt;&lt;a href="/view.aspx?sf=137191/442502/randtime.mw"&gt;Download randtime.mw&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Georgios Kokovidis&lt;/p&gt;
&lt;p&gt;Dr&amp;auml;ger Medical&lt;/p&gt;</description>
      <guid>137191</guid>
      <pubDate>Sun, 09 Sep 2012 06:20:18 Z</pubDate>
      <itunes:author>gkokovidis</itunes:author>
      <author>gkokovidis</author>
    </item>
    <item>
      <title>speed</title>
      <link>http://www.mapleprimes.com/questions/137189-Using-Random-Numbers?ref=Feed:MaplePrimes:Using random numbers:Comments#answer137192</link>
      <itunes:summary>&lt;p&gt;If you want it fast then you could compute the random values up front, using Statistics:-Sample and then access them one at a time, as you need them, from that resulting Array/Vector.&lt;/p&gt;
&lt;p&gt;It will take memory, however, to store all the precomputed values up front. It is also possible to take a middle road -- by precomputing in smaller batches. In recent Maple a float[8] Vector can be (memory efficiently) re-used repeatedly as the container into which one periodically computes batches of the random values.&lt;/p&gt;
&lt;p&gt;Another way to precompute a sample of floats from the uniform distribution on [0,1) is with the `rtable` constructor, or more conveniently by accessing that though the LinearAlgebra package's commands `RandomVector` and `RandomMatrix`.&lt;/p&gt;
&lt;pre&gt;V:=LinearAlgebra:-RandomVector[row](3,generator=0.0..1.0,
                                 outputoptions=[datatype=float[8]]);

       V := [0.223811939491137, 0.585267750979777, 0.340385726666133]

X:=Statistics:-RandomVariable('Uniform'(0,1)):

S:=Statistics:-Sample(X,3);

       S := [0.751267059305653, 0.255095115459269, 0.505957051665142]

Statistics:-Sample(X,S):  # re-using S
S;

          [0.699076722656686, 0.890903252535798, 0.959291425205444]
&lt;/pre&gt;
&lt;p&gt;You can compare with calling GenerateFloat() or rand() repeatedly. Note that `randomize` usually only needs to be called once, upon restart. The following is on 64bit Maple 16.01 for Windows 7.&lt;/p&gt;
&lt;pre&gt;restart:
randomize():
st := time():
X:=Statistics:-RandomVariable('Uniform'(0,1)):
S:=Statistics:-Sample(X,5000000):
for i from 1 by 1 to 5000000 do
S[i];
end do:
time() - st;

                                    2.792

restart:
randomize():
with(RandomTools[MersenneTwister]):
st := time():
for i from 1 by 1 to 5000000 do
GenerateFloat();
end do:
time() - st;

                                   11.170

restart:
randomize():
st := time():
for i from 1 by 1 to 5000000 do
rand()/(1000000000000.);
end do:
time() - st;

                                   29.063
&lt;/pre&gt;
&lt;!--break--&gt;
&lt;p&gt;Statistics:-Sample and the rtable constructors also respect the `randomize()` command.&lt;/p&gt;
&lt;p&gt;acer&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;If you want it fast then you could compute the random values up front, using Statistics:-Sample and then access them one at a time, as you need them, from that resulting Array/Vector.&lt;/p&gt;
&lt;p&gt;It will take memory, however, to store all the precomputed values up front. It is also possible to take a middle road -- by precomputing in smaller batches. In recent Maple a float[8] Vector can be (memory efficiently) re-used repeatedly as the container into which one periodically computes batches of the random values.&lt;/p&gt;
&lt;p&gt;Another way to precompute a sample of floats from the uniform distribution on [0,1) is with the `rtable` constructor, or more conveniently by accessing that though the LinearAlgebra package's commands `RandomVector` and `RandomMatrix`.&lt;/p&gt;
&lt;pre&gt;V:=LinearAlgebra:-RandomVector[row](3,generator=0.0..1.0,
                                 outputoptions=[datatype=float[8]]);

       V := [0.223811939491137, 0.585267750979777, 0.340385726666133]

X:=Statistics:-RandomVariable('Uniform'(0,1)):

S:=Statistics:-Sample(X,3);

       S := [0.751267059305653, 0.255095115459269, 0.505957051665142]

Statistics:-Sample(X,S):  # re-using S
S;

          [0.699076722656686, 0.890903252535798, 0.959291425205444]
&lt;/pre&gt;
&lt;p&gt;You can compare with calling GenerateFloat() or rand() repeatedly. Note that `randomize` usually only needs to be called once, upon restart. The following is on 64bit Maple 16.01 for Windows 7.&lt;/p&gt;
&lt;pre&gt;restart:
randomize():
st := time():
X:=Statistics:-RandomVariable('Uniform'(0,1)):
S:=Statistics:-Sample(X,5000000):
for i from 1 by 1 to 5000000 do
S[i];
end do:
time() - st;

                                    2.792

restart:
randomize():
with(RandomTools[MersenneTwister]):
st := time():
for i from 1 by 1 to 5000000 do
GenerateFloat();
end do:
time() - st;

                                   11.170

restart:
randomize():
st := time():
for i from 1 by 1 to 5000000 do
rand()/(1000000000000.);
end do:
time() - st;

                                   29.063
&lt;/pre&gt;
&lt;!--break--&gt;
&lt;p&gt;Statistics:-Sample and the rtable constructors also respect the `randomize()` command.&lt;/p&gt;
&lt;p&gt;acer&lt;/p&gt;</description>
      <guid>137192</guid>
      <pubDate>Sun, 09 Sep 2012 06:50:56 Z</pubDate>
      <itunes:author>acer</itunes:author>
      <author>acer</author>
    </item>
    <item>
      <title>Time command</title>
      <link>http://www.mapleprimes.com/questions/137189-Using-Random-Numbers?ref=Feed:MaplePrimes:Using random numbers:Comments#answer137206</link>
      <itunes:summary>&lt;p&gt;Thanks to both of you. I learned the time command and several new ways to collect random numbers. I am trying to simulate how well the distribution of Karl Pearsons well-known Test Statistics is following the Chi-Square distribution. I will need a high number of samples, so probably I can use some of the techniques you describe.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Erik&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Thanks to both of you. I learned the time command and several new ways to collect random numbers. I am trying to simulate how well the distribution of Karl Pearsons well-known Test Statistics is following the Chi-Square distribution. I will need a high number of samples, so probably I can use some of the techniques you describe.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Erik&lt;/p&gt;</description>
      <guid>137206</guid>
      <pubDate>Sun, 09 Sep 2012 16:13:49 Z</pubDate>
      <itunes:author>erik10</itunes:author>
      <author>erik10</author>
    </item>
  </channel>
</rss>