 




<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The VBScript Network and Systems Administrator&#039;s Cafe &#187; Random Numbers</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/tag/random-numbers/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator</link>
	<description></description>
	<lastBuildDate>Tue, 11 Oct 2011 18:36:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>VBScript Statements: Explanation of the Randomize Statement</title>
		<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/vbscript-statements-explanation-of-the-randomize-statement/</link>
		<comments>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/vbscript-statements-explanation-of-the-randomize-statement/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 14:04:24 +0000</pubDate>
		<dc:creator>Jerry Lees</dc:creator>
				<category><![CDATA[Random Numbers]]></category>
		<category><![CDATA[randomize]]></category>
		<category><![CDATA[VBScript Statements]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/vbscript-statements-explanation-of-the-randomize-statement/</guid>
		<description><![CDATA[The Randomize statement seeds the VBScript random number generation engine with a new seed. A seed is a user defined value that helps create a random number. There are no options for the Randomize statement, it&#8217;s use is simply: Randomize]]></description>
				<content:encoded><![CDATA[<p>The Randomize statement seeds the VBScript random number generation engine with a new seed. A seed is a user defined value that helps create a random number.</p>
<p>There are no options for the Randomize statement, it&#8217;s use is simply:</p>
<p><font color="#0000ff">Randomize</font></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/vbscript-statements-explanation-of-the-randomize-statement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to use the VBScript Scripting.Dictionary object to store data to make key decisions.</title>
		<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/how-to-use-the-vbscript-scriptingdictionary-object-to-store-data-to-make-key-decisions/</link>
		<comments>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/how-to-use-the-vbscript-scriptingdictionary-object-to-store-data-to-make-key-decisions/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 03:23:02 +0000</pubDate>
		<dc:creator>Jerry Lees</dc:creator>
				<category><![CDATA[Random Numbers]]></category>
		<category><![CDATA[randomize]]></category>
		<category><![CDATA[rnd]]></category>
		<category><![CDATA[Scripting.Dictionary]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[VBScript Functions]]></category>
		<category><![CDATA[VBScript Objects]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/how-to-use-the-vbscript-scriptingdictionary-object-to-store-data-to-make-key-decisions/</guid>
		<description><![CDATA[I&#8217;ve been writing lately on individual topics and thought it was time for a little fun, while introducing you to a new object in the process&#8230; the Scripting.Dictionary object! (and random number generation in the process) The Scripting.Dictionary object is a quite useful object. It will let you store data in a categorized manner through [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been writing lately on individual topics and thought it was time for a little fun, while introducing you to a new object in the process&#8230; the <font color="#000000"><a target="_blank" href="http://msdn.microsoft.com/en-us/library/x4k5wbx4(VS.85).aspx">Scripting.Dictionary </a>object! (and random number generation in the process)</font></p>
<p>The Scripting.Dictionary object is a quite useful object. It will let you store data in a categorized manner through it&#8217;s use of a <em>key</em> when you add data to the object. It works very much like a multi-dimensional array would, except that it is much easier to retrieve a specific type of data.</p>
<p>You place the data into the object via the <em>.add</em> method and retrieve a specific item via it&#8217;s key. The key can either be numeric or a string. In the example below, I&#8217;ve chosen a number. Now for the example&#8230; a script so useful that I&#8217;m certain it will become a key part of your decision making process at work&#8230; The Magic Eight Ball! Now, before you laugh not everyone has a magic eight ball (I have two) and that&#8217;s a shame because they really do help with making decisions.</p>
<p>Just run the script below several times and ask it these questions:</p>
<p><em>Will anyone notice if I reboot the exchange server now?<br />
Will the network survive while the Network Guys upgrade the switches?<br />
Will the servers survive another patch Tuesday?<br />
Does my boss appreciate me enough to give me a $10,000 raise?</em></p>
<p>And now for the example code you&#8217;ve been waiting for&#8230;</p>
<p><font color="#0000ff"> Option explicit<br />
Dim objDictionary<br />
Set objDictionary = CreateObject(&#8220;Scripting.Dictionary&#8221;)</font></p>
<p><font color="#0000ff">objDictionary.Add 1, &#8220;All signs point to NO&#8221;<br />
objDictionary.Add 2, &#8220;Outlook not likely&#8221;<br />
objDictionary.Add 3, &#8220;All signs point to YES&#8221;<br />
objDictionary.Add 4, &#8220;Maybe&#8221;<br />
objDictionary.Add 5, &#8220;You want what&#8230; When?&#8221;<br />
objDictionary.Add 6, &#8220;Definitely&#8221;<br />
objDictionary.Add 7, &#8220;Reply Hazy, try again later&#8221;<br />
objDictionary.Add 8, &#8220;I could tell you, but I&#8217;d have to kill you&#8221;<br />
objDictionary.Add 9, &#8220;Sure, why not.&#8221;<br />
objDictionary.Add 10, &#8220;One word Answer. Snowball&#8230; you figure it out.&#8221;</font></p>
<p><font color="#0000ff">Dim Answer<br />
Randomize</font></p>
<p><font color="#0000ff">Do<br />
 Answer = int(Rnd(1)*10)<br />
Loop While (Answer &lt; 1)<br />
WScript.Echo objDictionary.Item(Answer)</font></p>
<p><font color="#0000ff"><font color="#000000"><font color="#0000ff"><font color="#0000ff"><font color="#000000"><font color="#0000ff"><font color="#000000">As always, this code works perfectly. However, sometimes the formatting of the blog breaks the code if you copy and paste it into your editor. So, if you’d like to not type or troubleshoot any syntax errors due to the copy and paste problems&#8211; I’ve provided the code for download, plus example output files  from my final tests for you. You’ll find the code and other files available for download from my website’s (<a href="http://www.websystemsadministration.com/">www.websystemsadministration.com</a>) File Depot under the <font color="#0000ff"><em>ITKE Blog Scripts</em></font> category.<font color="#0000ff"> </font><font color="#0000ff"><font color="#0000ff"><font color="#000000">Enjoy and happy scripting!</font></font></font></font></font></p>
<p></font></font></font></font></font></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/how-to-use-the-vbscript-scriptingdictionary-object-to-store-data-to-make-key-decisions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
