<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Get random numbers under BASH and DOS</title>
	<atom:link href="http://9rivers.linkka.com/2010/03/01/get-random-numbers-under-bash-and-dos/feed/" rel="self" type="application/rss+xml" />
	<link>http://9rivers.linkka.com/2010/03/01/get-random-numbers-under-bash-and-dos/</link>
	<description>Molecular modeling in Materials Sciences Web development Programming IT</description>
	<lastBuildDate>Mon, 20 Jun 2011 09:37:31 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: 9rivers</title>
		<link>http://9rivers.linkka.com/2010/03/01/get-random-numbers-under-bash-and-dos/comment-page-1/#comment-508</link>
		<dc:creator>9rivers</dc:creator>
		<pubDate>Fri, 18 Feb 2011 11:45:25 +0000</pubDate>
		<guid isPermaLink="false">http://9rivers.linkka.com/?p=357#comment-508</guid>
		<description>Aha! random, you are in trouble with the so-called &quot;delayed variable expansion&quot; in DOS batch. This has been discussed here: http://blogs.msdn.com/b/oldnewthing/archive/2006/08/23/714650.aspx . 

In your case, in order to get 100 DIFFERENT random numbers, you have to enable the delayed variable expansion for your DOS console. Do this &quot;cmd /v&quot; to start it, or add this &quot;setlocal enabledelayexpansion&quot; in your batch file. Then, another important thing is to change the &quot;%&quot; symbol to &quot;!&quot; for the variables you want them to be expanded on the fly. E.g. try
&quot;FOR /L %%a IN (0,1,100) DO @echo !RANDOM!&quot; in your file, you&#039;ll get 100 DIFFERENT random numbers!</description>
		<content:encoded><![CDATA[<p>Aha! random, you are in trouble with the so-called &#8220;delayed variable expansion&#8221; in DOS batch. This has been discussed here: <a href="http://blogs.msdn.com/b/oldnewthing/archive/2006/08/23/714650.aspx" rel="nofollow">http://blogs.msdn.com/b/oldnewthing/archive/2006/08/23/714650.aspx</a> . </p>
<p>In your case, in order to get 100 DIFFERENT random numbers, you have to enable the delayed variable expansion for your DOS console. Do this &#8220;cmd /v&#8221; to start it, or add this &#8220;setlocal enabledelayexpansion&#8221; in your batch file. Then, another important thing is to change the &#8220;%&#8221; symbol to &#8220;!&#8221; for the variables you want them to be expanded on the fly. E.g. try<br />
&#8220;FOR /L %%a IN (0,1,100) DO @echo !RANDOM!&#8221; in your file, you&#8217;ll get 100 DIFFERENT random numbers!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: random</title>
		<link>http://9rivers.linkka.com/2010/03/01/get-random-numbers-under-bash-and-dos/comment-page-1/#comment-505</link>
		<dc:creator>random</dc:creator>
		<pubDate>Thu, 10 Feb 2011 19:58:35 +0000</pubDate>
		<guid isPermaLink="false">http://9rivers.linkka.com/?p=357#comment-505</guid>
		<description>What about use %RANDOM% inside FOR in ms-DOS
ex:
FOR /L %%a IN (0,1,100) DO @echo %RANDOM%
I would generate 100 DIFFERENT random numbers but the line above generates 100 times the same number!!! What&#039;s up?</description>
		<content:encoded><![CDATA[<p>What about use %RANDOM% inside FOR in ms-DOS<br />
ex:<br />
FOR /L %%a IN (0,1,100) DO @echo %RANDOM%<br />
I would generate 100 DIFFERENT random numbers but the line above generates 100 times the same number!!! What&#8217;s up?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

