document.write('<div class="vbnet" style="font-family: monospace;"><br />');
document.write('<span style="color: #FF8000;">Option</span> Explicit <span style="color: #FF8000;">On</span><br />');
document.write('<span style="color: #FF8000;">Option</span> Strict <span style="color: #FF8000;">On</span><br />');
document.write('<br />');
document.write('<span style="color: #0600FF;">Imports</span> System<br />');
document.write('<span style="color: #0600FF;">Imports</span> System.<span style="color: #0000FF;">Text</span><br />');
document.write('<br />');
document.write('<span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Class</span> PasswordGenerator<br />');
document.write('&nbsp; &nbsp; <span style="color: #FF8000;">Private</span> PWD_LENGTH <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span><br />');
document.write('<br />');
document.write('#Region <span style="color: #808080;">&quot; Random Number Generation &quot;</span><br />');
document.write('&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'The following class and code in this region was designed</span><br />');
document.write('&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'by Phill64 on http://www.vbforums.com.&nbsp; All credit for </span><br />');
document.write('&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'random number generation goes to him.</span><br />');
document.write('&nbsp; &nbsp; Protected <span style="color: #0600FF;">Class</span> TrueRandom2<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Function</span> GetDouble<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Double</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> r <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> Security.<span style="color: #0000FF;">Cryptography</span>.<span style="color: #0000FF;">RNGCryptoServiceProvider</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> bt<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">15</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Byte</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; r.<span style="color: #0000FF;">GetNonZeroBytes</span><span style="color: #000000;">&#40;</span>bt<span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> d <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Double</span> = bt<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">For</span> i <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = <span style="color: #FF0000;">1</span> <span style="color: #FF8000;">To</span> <span style="color: #FF0000;">15</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; d *= bt<span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Next</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; d /= <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">10</span> ^ <span style="color: #000000;">&#40;</span>Math.<span style="color: #0000FF;">Floor</span><span style="color: #000000;">&#40;</span>d<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToString</span>.<span style="color: #0000FF;">Length</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; d -= Math.<span style="color: #0000FF;">Floor</span><span style="color: #000000;">&#40;</span>d<span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return d<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Function</span> GetNext<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> lower <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span>, <span style="color: #FF8000;">ByVal</span> upper <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'returns a random itneger between specified bounds</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'ratio a random decimal number to the required bounds</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'Changed CInt to Convert.ToInt32 Derek</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return Convert.<span style="color: #0000FF;">ToInt32</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>lower + <span style="color: #000000;">&#40;</span>GetDouble<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> * <span style="color: #000000;">&#40;</span>upper - lower<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Function</span> GetNext<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'returns a random integer</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'Changed CInt to Convert.ToInt32 Derek</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return Convert.<span style="color: #0000FF;">ToInt32</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>GetDouble<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> * <span style="color: #FF0000;">Integer</span>.<span style="color: #0000FF;">MaxValue</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Function</span> GetLong<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Long</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'Changed CLng to Convert.ToInt64 Derek</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return Convert.<span style="color: #0000FF;">ToInt64</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>GetDouble<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> * <span style="color: #FF0000;">Long</span>.<span style="color: #0000FF;">MaxValue</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span><br />');
document.write('&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span><br />');
document.write('#End Region<br />');
document.write('<br />');
document.write('&nbsp; &nbsp; <span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Sub</span> <span style="color: #FF8000;">New</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; PWD_LENGTH = <span style="color: #FF0000;">13</span><br />');
document.write('&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; <span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Sub</span> <span style="color: #FF8000;">New</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> PasswordLength <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span><span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; PWD_LENGTH = PasswordLength<br />');
document.write('&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; <span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Function</span> Generate<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> pwd <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> = <span style="color: #FF8000;">String</span>.<span style="color: #FF8000;">Empty</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> rng <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> TrueRandom2<br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">For</span> i <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = <span style="color: #FF0000;">1</span> <span style="color: #FF8000;">To</span> PWD_LENGTH<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> GoodValue <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span> = <span style="color: #0600FF;">False</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Do</span> <span style="color: #0600FF;">While</span> <span style="color: #804040;">Not</span> GoodValue<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'ASCII value range 32 to 126.</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> value <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = rng.<span style="color: #0000FF;">GetNext</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">32</span>, <span style="color: #FF0000;">126</span><span style="color: #000000;">&#41;</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pwd += Convert.<span style="color: #0000FF;">ToChar</span><span style="color: #000000;">&#40;</span>value<span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GoodValue = <span style="color: #0600FF;">True</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Loop</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Next</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; rng = <span style="color: #FF8000;">Nothing</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; Return pwd<br />');
document.write('&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; <span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Function</span> Generate<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> AsciiMin <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span>, <span style="color: #FF8000;">ByVal</span> AsciiMax <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> pwd <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> = <span style="color: #FF8000;">String</span>.<span style="color: #FF8000;">Empty</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> rng <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> TrueRandom2<br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">For</span> i <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = <span style="color: #FF0000;">1</span> <span style="color: #FF8000;">To</span> PWD_LENGTH<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> GoodValue <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span> = <span style="color: #0600FF;">False</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Do</span> <span style="color: #0600FF;">While</span> <span style="color: #804040;">Not</span> GoodValue<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'ASCII value range AsciiMin to AsciiMax, to get the correct </span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'range we need to take AsciiMax - AsciiMin = (Ascii Range)</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> value <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = rng.<span style="color: #0000FF;">GetNext</span><span style="color: #000000;">&#40;</span>AsciiMin, AsciiMax<span style="color: #000000;">&#41;</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pwd += Convert.<span style="color: #0000FF;">ToChar</span><span style="color: #000000;">&#40;</span>value<span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GoodValue = <span style="color: #0600FF;">True</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Loop</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Next</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; rng = <span style="color: #FF8000;">Nothing</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; Return pwd<br />');
document.write('&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; <span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Function</span> Generate<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> AsciiMin <span style="color: #FF8000;">As</span> Char, <span style="color: #FF8000;">ByVal</span> AsciiMax <span style="color: #FF8000;">As</span> Char<span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> pwd <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> = <span style="color: #FF8000;">String</span>.<span style="color: #FF8000;">Empty</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> rng <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> TrueRandom2<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> iAsciiMin <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = Convert.<span style="color: #0000FF;">ToInt32</span><span style="color: #000000;">&#40;</span>AsciiMin<span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> iAsciiMax <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = Convert.<span style="color: #0000FF;">ToInt32</span><span style="color: #000000;">&#40;</span>AsciiMax<span style="color: #000000;">&#41;</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">For</span> i <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = <span style="color: #FF0000;">1</span> <span style="color: #FF8000;">To</span> PWD_LENGTH<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> GoodValue <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span> = <span style="color: #0600FF;">False</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Do</span> <span style="color: #0600FF;">While</span> <span style="color: #804040;">Not</span> GoodValue<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'ASCII value range AsciiMin to AsciiMax, to get the correct </span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'range we need to take AsciiMax - AsciiMin = (Ascii Range)</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> value <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = rng.<span style="color: #0000FF;">GetNext</span><span style="color: #000000;">&#40;</span>iAsciiMin, iAsciiMax<span style="color: #000000;">&#41;</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pwd += Convert.<span style="color: #0000FF;">ToChar</span><span style="color: #000000;">&#40;</span>value<span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GoodValue = <span style="color: #0600FF;">True</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Loop</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Next</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; rng = <span style="color: #FF8000;">Nothing</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; Return pwd<br />');
document.write('&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; <span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Function</span> Generate<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> ExcludeValues <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> pwd <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> = <span style="color: #FF8000;">String</span>.<span style="color: #FF8000;">Empty</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> rng <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> TrueRandom2<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> ASCII_VAL<span style="color: #000000;">&#40;</span>ExcludeValues.<span style="color: #0000FF;">Length</span> - <span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'Convert the excluded values to the the ASCII</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'equivalent of the character represention and</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'add it to the ASCII_VAL array.</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">For</span> i <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = <span style="color: #FF0000;">0</span> <span style="color: #FF8000;">To</span> ExcludeValues.<span style="color: #0000FF;">Length</span> - <span style="color: #FF0000;">1</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ASCII_VAL<span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span> = Convert.<span style="color: #0000FF;">ToInt32</span><span style="color: #000000;">&#40;</span>ExcludeValues<span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Chars</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Next</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Array</span>.<span style="color: #0000FF;">Sort</span><span style="color: #000000;">&#40;</span>ASCII_VAL<span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">For</span> i <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = <span style="color: #FF0000;">1</span> <span style="color: #FF8000;">To</span> PWD_LENGTH<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> GoodValue <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span> = <span style="color: #0600FF;">False</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Do</span> <span style="color: #0600FF;">While</span> <span style="color: #804040;">Not</span> GoodValue<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'ASCII value range 32 to 126.</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> value <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = rng.<span style="color: #0000FF;">GetNext</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">32</span>, <span style="color: #FF0000;">126</span><span style="color: #000000;">&#41;</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'Determine if the value that was generated is</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'not an excluded value.</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">If</span> <span style="color: #0600FF;">Array</span>.<span style="color: #0000FF;">BinarySearch</span><span style="color: #000000;">&#40;</span>ASCII_VAL, value<span style="color: #000000;">&#41;</span> &lt; <span style="color: #FF0000;">0</span> <span style="color: #FF8000;">Then</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pwd += Convert.<span style="color: #0000FF;">ToChar</span><span style="color: #000000;">&#40;</span>value<span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GoodValue = <span style="color: #0600FF;">True</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Loop</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Next</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; rng = <span style="color: #FF8000;">Nothing</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; Return pwd<br />');
document.write('&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; <span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Function</span> Generate<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> AsciiMin <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span>, <span style="color: #FF8000;">ByVal</span> AsciiMax <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span>, <span style="color: #FF8000;">ByVal</span> ExcludeValues <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> pwd <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> = <span style="color: #FF8000;">String</span>.<span style="color: #FF8000;">Empty</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> rng <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> TrueRandom2<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> ASCII_VAL<span style="color: #000000;">&#40;</span>ExcludeValues.<span style="color: #0000FF;">Length</span> - <span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'Convert the excluded values to the the ASCII</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'equivalent of the character represention and</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'add it to the ASCII_VAL array.</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">For</span> i <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = <span style="color: #FF0000;">0</span> <span style="color: #FF8000;">To</span> ExcludeValues.<span style="color: #0000FF;">Length</span> - <span style="color: #FF0000;">1</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ASCII_VAL<span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span> = Convert.<span style="color: #0000FF;">ToInt32</span><span style="color: #000000;">&#40;</span>ExcludeValues<span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Chars</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Next</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Array</span>.<span style="color: #0000FF;">Sort</span><span style="color: #000000;">&#40;</span>ASCII_VAL<span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">For</span> i <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = <span style="color: #FF0000;">1</span> <span style="color: #FF8000;">To</span> PWD_LENGTH<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> GoodValue <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span> = <span style="color: #0600FF;">False</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Do</span> <span style="color: #0600FF;">While</span> <span style="color: #804040;">Not</span> GoodValue<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'ASCII value range AsciiMin to AsciiMax, to get the correct </span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'range we need to take AsciiMax - AsciiMin = (Ascii Range)</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> value <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = rng.<span style="color: #0000FF;">GetNext</span><span style="color: #000000;">&#40;</span>AsciiMin, AsciiMax<span style="color: #000000;">&#41;</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'Determine if the value that was generated is</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'not an excluded value.</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">If</span> <span style="color: #0600FF;">Array</span>.<span style="color: #0000FF;">BinarySearch</span><span style="color: #000000;">&#40;</span>ASCII_VAL, value<span style="color: #000000;">&#41;</span> &lt; <span style="color: #FF0000;">0</span> <span style="color: #FF8000;">Then</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pwd += Convert.<span style="color: #0000FF;">ToChar</span><span style="color: #000000;">&#40;</span>value<span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GoodValue = <span style="color: #0600FF;">True</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Loop</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Next</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; rng = <span style="color: #FF8000;">Nothing</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; Return pwd<br />');
document.write('&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; <span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Function</span> Generate<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> AsciiMin <span style="color: #FF8000;">As</span> Char, <span style="color: #FF8000;">ByVal</span> AsciiMax <span style="color: #FF8000;">As</span> Char, <span style="color: #FF8000;">ByVal</span> ExcludeValues <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> pwd <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> = <span style="color: #FF8000;">String</span>.<span style="color: #FF8000;">Empty</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> rng <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> TrueRandom2<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> iAsciiMin <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = Convert.<span style="color: #0000FF;">ToInt32</span><span style="color: #000000;">&#40;</span>AsciiMin<span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> iAsciiMax <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = Convert.<span style="color: #0000FF;">ToInt32</span><span style="color: #000000;">&#40;</span>AsciiMax<span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> ASCII_VAL<span style="color: #000000;">&#40;</span>ExcludeValues.<span style="color: #0000FF;">Length</span> - <span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'Convert the excluded values to the the ASCII</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'equivalent of the character represention and</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'add it to the ASCII_VAL array.</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">For</span> i <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = <span style="color: #FF0000;">0</span> <span style="color: #FF8000;">To</span> ExcludeValues.<span style="color: #0000FF;">Length</span> - <span style="color: #FF0000;">1</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ASCII_VAL<span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span> = Convert.<span style="color: #0000FF;">ToInt32</span><span style="color: #000000;">&#40;</span>ExcludeValues<span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Chars</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Next</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Array</span>.<span style="color: #0000FF;">Sort</span><span style="color: #000000;">&#40;</span>ASCII_VAL<span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">For</span> i <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = <span style="color: #FF0000;">1</span> <span style="color: #FF8000;">To</span> PWD_LENGTH<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> GoodValue <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span> = <span style="color: #0600FF;">False</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Do</span> <span style="color: #0600FF;">While</span> <span style="color: #804040;">Not</span> GoodValue<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'ASCII value range AsciiMin to AsciiMax, to get the correct </span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'range we need to take AsciiMax - AsciiMin = (Ascii Range)</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> value <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = rng.<span style="color: #0000FF;">GetNext</span><span style="color: #000000;">&#40;</span>iAsciiMin, iAsciiMax<span style="color: #000000;">&#41;</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'Determine if the value that was generated is</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">\'not an excluded value.</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">If</span> <span style="color: #0600FF;">Array</span>.<span style="color: #0000FF;">BinarySearch</span><span style="color: #000000;">&#40;</span>ASCII_VAL, value<span style="color: #000000;">&#41;</span> &lt; <span style="color: #FF0000;">0</span> <span style="color: #FF8000;">Then</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pwd += Convert.<span style="color: #0000FF;">ToChar</span><span style="color: #000000;">&#40;</span>value<span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GoodValue = <span style="color: #0600FF;">True</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Loop</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Next</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; rng = <span style="color: #FF8000;">Nothing</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; Return pwd<br />');
document.write('&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span><br />');
document.write('<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span><br />');
document.write('&nbsp;</div>');
document.write('<br />&nbsp;<br /><div style="font-size: 12px">Brought to you by the community at <a href="http://www.bytemycode.com/snippets/snippet/389/1/" target="_blank">byteMyCode</a>.</div>');
