## Need a little VB.Net help Tags:
Random
VB.NET
Need a little VB.Net help. TheFinder was attempting to find a good solution to a lottery number picking problem. He needed to pick 6 numbers, each from 1 to 50 but no two duplicating. The six numbers had to total to a target value input by the user between 21 and 285.

I developed an algorithm (in GetSix below) that I believe will give a quick and simple solution to the problem. Unfortunately, I’m not VB.Net adept and I don’t have VB. If someone would like to fix up this code and give us a little idea of the performance (time and/or number of loops), that would be interesting.

[Code]

.. mainline

Dim targetValue as Integer

Dim Num1, Num2, Num3, Num4, Num5, Num6 as Integer

Dim CountOfTries as Integer targetValue = 98 // targetValue would be user input between 21 and 285

If GetSix(targetValue, Num1, Num2, Num3, Num4, Num5, Num6,   CountOfTries)

// here we’ve got 6 good values and the CountOfTries

Else

// here we’ve got an error

Endif

Public Function GetSix(ByVal target As Integer ByRef N1 As Integer, ByRef N2 As Integer, ByRef N3 As Integer, ByRef N4 As Integer, ByRef N5 As Integer, ByRef N6 As Integer, ByRef CountLoop As Integer) as Boolean

Dim Success as Boolean = true

CountLoop = 0 Do until ((N1<>N2 and N1<>N3 and N1<>N4 and N1<>N5 and N1<>N6 and N2<>N3 and N2<>N4 and N2<>N5 and N2<>N6 and N3<>N4 and N3<>N5 and N3<>N6 and N4<>N5 and N4<>N6 and N5<>N6) or Success = False)           CountLoop += 1 // CountLoop saves us from an endless loop – but that shouldn’t happen

N1 = RandomBetween(Max(target-240,1),Min(50,target-15))             N2=RandomBetween(Max(target-N1-194,1),Min(50,target-10-N1))      N3= RandomBetween(Max(target-N1-N2-147,1),Min(50,target-6-N1-N2))

N4=RandomBetween(Max(target-N1-N2-N3-99,1),Min(target-3-N1-N2-N3))

N5=RandomBetween(Max(target-N1-N2-N3-N4-50,1),Max(50,target-1-N1-N2-N3-N4))

N6=target-(N1+N2+N3+N4+N5)

If CountLoop > 250

Success = False

Endif Loop

Return Success

End Function

Public Function RandomBetween(ByVal Min As Integer, ByVal Max As Integer) As Integer

Dim MyRandom As System.Random = New System.Rando()

Return MyRandom.Next(Min, Max)

End Function

[/ECODE] Now I've Messed up the formating replacing iif clauses with min and max -- thanks Tom, I didn't think about this touch.

Software/Hardware used:
VB.Net 9</pre>

Thanks. We'll let you know when a new response is added.

## Discuss This Question: 50 Replies

Thanks. We'll let you know when a new response is added.
• Correction to the code N5=RandomBetween(IIf(target-N1-N2-N3-N4>50,\$G\$2-N1-N2-N3-N4-50,1),IIf(target-1-N1-N2-N3-N4>50,50,target-1-N1-N2-N3-N4)) -- sorry \$G\$2 is left over from my experiments in Excel and should be target N5=RandomBetween(IIf(target-N1-N2-N3-N4>50,target-N1-N2-N3-N4-50,1),IIf(target-1-N1-N2-N3-N4>50,50,target-1-N1-N2-N3-N4)) Phil
report
• I don't have a useful VB at home (where I can spend time on something like this.) But logic is logic. A REXX mainline looks something like this:
```say 'New sequence --'
say time('L')

do i=1 to 6
say format(i,2) format(g.i,3)
gsum = gsum + g.i  /* Sum 'given' six */
end

say ' :' format(gsum,3)

r. = 0
diff = gsum

do i=1 to 5
brk=0
rm = RemMin( i )
do until brk=1
r.i = random( 1 , min(50, max((diff-rm),rm)) )
eq=0
/* Check against "given" 6... */
do j=1 to 6
if r.i = g.j then eq=1
end
/* Check against previous chosen... */
if i>1 then
do j=1 to ( i - 1 )
if r.i = r.j then eq=1
end
if eq=0 then brk=1
end
diff = diff - r.i
say format(i,2) format(r.i,3)
end

r.6 = diff
say format(6,2) format(r.6,3)
say time('L')

exit

RemMin:
arg curVals
remVals = 7 - curVals
rtnVal = 0
do z=1 to remvals; rtnVal=rtnVal + z ; end
return rtnVal```
Sample output:
```16:29:47.121000
1   2
2   5
3  17
4  19
5  39
6  43
: 125

1  37
2  31
3  10
4  21
5  15
6  11
16:29:47.289000

New sequence --
16:30:45.521000
1  37
2  31
3  10
4  21
5  15
6  11
: 125

1  24
2  35
3  40
4   6
5   3
6  17
16:30:45.685000

New sequence --
16:56:51.907000
1  24
2  35
3  40
4   6
5   3
6  17
: 125

1  15
2  26
3  38
4   4
5  13
6  29
16:56:52.060000
```
The output shows three sample runs. Each run uses the six numbers from the previous run as the 'given' six for the next run. In this series the first group of six happened to total 125 rather than 98 because I generated six numbers to start it all off. A timestamp is displayed at the beginning and end of each run. The runs take around .17 seconds. The 'given' six are displayed first along with the sum of the six (always 125 here). Then the new six random numbers are displayed as they're generated. It has a minor flaw as coded. The generated 6th number can be a repeat of one of the 'given' six. That's because there is no choice for the last number; it must be whatever is left over after the first five are generated. If it must also not be one of the 'given' six, it can be tested and the test can simply loop the mainline over again. At .17 seconds and a fairly small chance of a repeat number, it's not a big risk to do it again. If the logic was compiled rather than running in REXX on a relatively slow system, it doesn't seem worth much of a concern. The logic itself could also be improved. This is simply running in a sequence that mimics the basic requirements. It's not intended to be super fast. Tom
report
• Thanks Tom, This provides a good baseliine Your logic is going to get the solution on your system in 16+seconds Hoping someone can test my logic. I suspect that it will be mili-seconds. Phil
report
• But yours would be under a second compiled.
report
• I'll try to test it later today, and will let you know.
report
• Thanks Carlos Wonder if it even resembles VB. Phil
report
• ...in 16+seconds Note that it is "point 1 6", i.e., less than two-tenths of a second for the REXX, most of which is in the I/O. I certainly expect that that's a high limit and that other solutions would be even faster. Tom
report
• Cool Flash, POINT 16 seconds, the eyes are the second thing to go, and I don't remember the first two. This should make theFinder's day. Phil
report
• Cool Flash, POINT 16 seconds,... Yeah, that's why I wasn't sure way back at the beginning why some general discussion points seemed unacceptable. Without serious context, it's not clear if the requirement is actually more like .000016 (or less) seconds. Certainly if this was to be a part of some encryption/decryption algorithm that must be applied for many rounds or some other highly repetitive operation, for example, then maybe true high-speed really needs to be part of it. OTOH, I didn't want to leave the question behind because sometimes routines can be "good enough". We all decide for ourselves where the point of "good enough" is. Working much past that point gives diminishing returns. But that's a significant part of programming -- making that judgment. Tom
report
• To slow! programs are supposed to be done before the user presses the enter key!
report
• Like the character Radar O’Reilly in M.A.S.H. computers should provide the answer just before we think of the question.
report
• This is still in my to-do list, Phil. I just haven't found the time to do it (And TheFinder is probably unaware of the existence of this thread).
report
• (And TheFinder is probably unaware of the existence of this thread). I was going to post my code when the weekend arrived, but the thread had been deleted. Since I had the page already opened in a previous tab, I considered creating a new question that had the same subject in order to be an eye-catcher. Then I saw Phil's post. Ah, well. Tom
report
• Well, when it's ready, maybe, mom and dad ITK can push something to finders' e-mail.
report
• I can do that. I've exchanged e-mails with him in the past.
report
• Simple and fast enough, that concept led to my 6 equation design. The user presses the enter key and before they blink the solution is on the screen. I have a suspicion that this simple solution will turn out to be as fast as more complex solutions. This solution will be about 15 times slower for target values at the lower or higher end of the range because the chance of generating duplicates increases considerably for these cases. I considered adding more complexity to speed up these cases, however, I concluded that - adding logic to speed up these cases might lead to worse performance on the rest of the cases - 15 times slower then very fast would still be fast enough Phil "America is a country that doesn't know where it is going but is determined to set a speed record getting there." Laurence J. Peter
report
• Code correction - max + 1 (see below) -- .next method apparently generates numbers from the min to but not including the max!!! -- while excel @randbetween is really min and max -- why would they do that!!! Phil Public Function RandomBetween(ByVal Min As Integer, ByVal Max As Integer) As Integer Dim MyRandom As System.Random = New System.Rando() Return MyRandom.Next(Min, Max + 1) End Function
report
• Try that again ... New System.Random() not New System.Rando() But I think that it only needs to create random class once and use .next directly in each equation again this would be an issue if we got poor performance. Phil Public Function RandomBetween(ByVal Min As Integer, ByVal Max As Integer) As Integer Dim MyRandom As System.Random = New System.Random() Return MyRandom.Next(Min, Max + 1) End Function
report
• This is the easy solution in VB.NET code done in VB.NET 2008. I believe that the minimum target number is 97. I didn’t change your algorithm but only. I only made sure that it follows your request The loops exit I would set to 2500. Dim rnd As New Random Public Function RandomBetween(ByVal Min As Integer, ByVal Max As Integer) As Integer Dim MyRandom As System.Random = New System.Random() Return MyRandom.Next(Min, Max) End Function Public Function GetSix(ByVal target As Integer, ByRef N1 As Integer, ByRef N2 As Integer, _ ByRef N3 As Integer, ByRef N4 As Integer, ByRef N5 As Integer, ByRef N6 As Integer, _ ByRef CountLoop As Integer) As Boolean Dim Success As Boolean = True CountLoop = 0 Do Until ((N1 <> N2 And N1 <> N3 And _ N1 <> N4 And N1 <> N5 And _ N1 <> N6 And N2 <> N3 And _ N2 <> N4 And N2 <> N5 And _ N2 <> N6 And N3 <> N4 And _ N3 <> N5 And N3 <> N6 And _ N4 <> N5 And N4 <> N6 And _ N5 <> N6) Or Success = False) 'Loop CountLoop += 1 'CountLoop saves us from an endless loop – but that shouldn’t happen N1 = RandomBetween(IIf(target - 240 > 1, target - 239, 1), IIf(50 > target - 13, 50, target - 13)) N2 = RandomBetween(IIf(target - N1 - 194 > 1, target - N1 - 193, 1), IIf(50 > target - 9 - N1, 50, target - 9 - N1)) N3 = RandomBetween(IIf(target - N1 - N2 - 147 > 1, target - N1 - N2 - 146, 1), _ IIf(50 > target - 6 - N1 - N2, 50, target - 6 - N1 - N2)) N4 = RandomBetween(IIf(target - N1 - N2 - N3 - 99 > 1, target - N1 - N2 - N3 - 99, 1), _ IIf(50 > target - 3 - N1 - N2 - N3, 50, target - 3 - N1 - N2 - N3)) N5 = RandomBetween(IIf(target - N1 - N2 - N3 - N4 - 50 > 1, target - N1 - N2 - N3 - N4 - 50, 1), _ IIf(50 > target - 1 - N1 - N2 - N3 - N4, 50, target - 1 - N1 - N2 - N3 - N4)) N6 = IIf(target - (N1 + N2 + N3 + N4 + N5) > 0, target - (N1 + N2 + N3 + N4 + N5), 1) If CountLoop > 25000 Then Success = False End If Loop Return Success End Function I’m hoping that everything is clear
report
• He needed to pick 6 numbers, each from 1 to 50 but no two duplicating. One part that wasn't clear in the original request was how the new six numbers needed to differ from the old six numbers. It was clear that the new set of six couldn't equal the old set of six; but could any individual members of the two sets be equal? The sample logic ensured that none of the first five new numbers matched any of the old six, but I chose to ignore the sixth number and allowed it to be a duplicate. For that logic, adding an outer test for the final remainder would allow catching that final equality. In test runs, it didn't happen often enough for a specific one of the six (the last one) for me to worry about it. Duplicates did happen often enough during generation of all numbers, though. Tom
report
• It is important to say that the random function depends on the system time. The algorithm is not so strong then because repeating the random request in the short period of the time will repeat the similar results. It requires additional modification of the code, calling the function in longer range of the time, or at least random call of the testing value. The other option also not so perfect could be calling the random function independently for each result with different testing value. However there was only request to make the code for above algorithm in VB so… that is done I believe
report
• Thanks Walrum target is any number between 21 and 285. It represents the total of 6 lottery numbers you've coded my solution - Tom added intermediate tests to insure thaat the 6 numbers didn't match before he when on. I'm not sure if that will be faster or not. Looks like you were working with an earlier version of my code. Most important change is in the RandomBetween function which should use Max +1 Return MyRandom.Next(Min, Max + 1 ) Thanks to Tom, I realized that the Iif's could be replaced with Max and Min;s But now the question is can you create a routine to exercise this and determine the performatice. Number of loops required and time. Tom would like to compare that with logic based on his REX model above with inmediate tests. Wow that's a lot. Tom I think the performance will be good enough to allow additional rules in the loop control as needed or a loop in the calling program. The rules might restrict the target range even further. Phil
report
• Yes, Tom, I guess we're about there. Apparently you and I had a little different starting spec's but this is great. ... Thanks Walrum
report
• I forgot important function that will initialize random generator. It is randomize() statement . it will give much better results and make better uniqueness. Regarding performance I will test soon some options. Regarding [ Max + 1] I give my answer soon. My question is what is actually max result of single number? Is it 49 or 50? Public Function RandomBetween(ByVal Min As Integer, ByVal Max As Integer) As Integer Dim MyRandom As System.Random = New System.Random() Randomize() ‘Inicialize random generator Return MyRandom.Next(Min, Max + 1) 'Return rnd.Next(Min, Max) End Function
report
• Cool I forgot important function that will initialize random generator. It is randomize() statement . it will give much better results and make better uniqueness. Regarding performance I will test soon some options. Regarding [ Max + 1] I give my answer soon. My question is what is actually max result of single number? Is it 49 or 50? 50 the lottery has balls labeled 1 to 50. My logic computes the max but the .next method uses Max - 1. Behind it is the old rand fuction which requried the same adjustment. thanks
report
• RE: randomize() This is an old function used with RND function. It doesn't look like it's needed or used with the random class. Every time the an object of this class is created it randomizes the object as part of the constructor process. Phil.
report
• but this looks like it's going to produce random numbers and better performance ByRef N3 As Integer, ByRef N4 As Integer, ByRef N5 As Integer, ByRef N6 As Integer, _ ByRef CountLoop As Integer) As Boolean Dim Success As Boolean = True Dim rnd1 As New Random() CountLoop = 0 Do Until ((N1 <> N2 And N1 <> N3 And _ N1 <> N4 And N1 <> N5 And _ N1 <> N6 And N2 <> N3 And _ N2 <> N4 And N2 <> N5 And _ N2 <> N6 And N3 <> N4 And _ N3 <> N5 And N3 <> N6 And _ N4 <> N5 And N4 <> N6 And _ N5 <> N6) Or Success = False) ‘Loop CountLoop += 1 ‘CountLoop saves us from an endless loop – but that shouldn’t happen N1 = rnd1.next(MAX( target - 239, 1), MIN( 50, target - 13) + 1 ) N2 = rnd1.next(MAX( target - N1 - 193, 1), MIN(50, target - 9 - N1) + 1) N3 = rnd1.next(MAX( target - N1 - N2 - 146, 1), MIN(50, target - 6 - N1 - N2) + 1) N4 = rnd1.next(MAX( target - N1 - N2 - N3 - 99, 1), MIN(50, target - 3 - N1 - N2 - N3) +1) N5 = rnd1.next(MAX( target - N1 - N2 - N3 - N4 - 50, 1), MIN(50, target - 1 - N1 - N2 - N3 - N4) +1) N6 = MAX( target - (N1 + N2 + N3 + N4 + N5), 1) If CountLoop > 25000 Then Success = False End If Loop
report
• Believe me or not Randomize() is performing better Random even now. This is related to the timer that still is playing significant roll in the Random process. If you call quick enough Random.next without Randomize() you will have the chance to see the same results. I tested already this behaviour end surprise… it is proving that.
report
• report
• Hi Everyone, Thanks for keeping this alive. I’ve gone down and read the threads and at times got lost, so if you will let me post the original question or problem and we go from there. Using Visual Basic what would be the smartest or logistical rout in achieving a random number generator generating a set of 6 unique numbers and when added together the sum of the six numbers would equals a given amount before starting the random generator say 98 or what ever. After getting this information it now has to generate the set of 6 numbers that equal 98. Thanks for any and all replies. Hope this stays and gets answered.
report
• I forgot to add "not that it matters" but the six numbers can be from 1 to 50 each but not two matching.
report
• Walrum Yes, I see, kind of. .next works fine, it's the constructor that's the problem. If the code creates two constructors within a click of the clock then you get the same series of .next values. That means that my randomBetween function isn't reliable. But my most recent post corrected this issue -- entirely by accident. It only creates the random class once and then runs the .next up to 25000 * 6 times .. is that legal. Only I missed a line or two when I posted it. Should be POSTED: Jan 24, 2012 2:57 PM (GMT)but this looks like it’s going to produce random numbers and better performance Public Function GetSix(ByVal target As Integer, ByRef N1 As Integer, ByRef N2 As Integer, _ ByRef N3 As Integer, ByRef N4 As Integer, ByRef N5 As Integer, ByRef N6 As Integer, _ ByRef CountLoop As Integer) As Boolean Dim Success As Boolean = True Dim rnd1 As New Random() CountLoop = 0 Do Until ((N1 <> N2 And N1 <> N3 And _ N1 <> N4 And N1 <> N5 And _ N1 <> N6 And N2 <> N3 And _ N2 <> N4 And N2 <> N5 And _ N2 <> N6 And N3 <> N4 And _ N3 <> N5 And N3 <> N6 And _ N4 <> N5 And N4 <> N6 And _ N5 <> N6) Or Success = False) ‘Loop CountLoop += 1 ‘CountLoop saves us from an endless loop – but that shouldn’t happen N1 = rnd1.next(MAX( target - 239, 1), MIN( 50, target - 13) + 1 ) N2 = rnd1.next(MAX( target - N1 - 193, 1), MIN(50, target - 9 - N1) + 1) N3 = rnd1.next(MAX( target - N1 - N2 - 146, 1), MIN(50, target - 6 - N1 - N2) + 1) N4 = rnd1.next(MAX( target - N1 - N2 - N3 - 99, 1), MIN(50, target - 3 - N1 - N2 - N3) +1) N5 = rnd1.next(MAX( target - N1 - N2 - N3 - N4 - 50, 1), MIN(50, target - 1 - N1 - N2 - N3 - N4) +1) N6 = MAX( target - (N1 + N2 + N3 + N4 + N5), 1) If CountLoop > 25000 Then Success = False End If Loop
report
• Walrum Are you saying the random class works with Randomize() Go for it. or is the Randomize() just slowing things down enough to get a tick of the clock. Should I recode this using Randomize() and rnd() ? Phil
report
• Finder Tom and I had slightly different takes on the rules There are 6 input digits I1, I2, I3, I4, I5, I6 and the program generates 6 digits N1, N2, N3, N4, N5, N6 Rule 1, you provided was that the total of the inputs should equal the total of the outputs (I1 + I2 + I3 + I4 + I5 + I6) = (N1 + N2 + N3 + N4 + N5 + N6) Rule 2, N1, N2, N3, N4, N5, N6 must all be different Rule 3, N1 - N6 must be between 1 and 50 Are there any more rules? like Rule 4, any digit cannot appear in the same location on the output as on the input N1 not equal to I1, N2 not equal to I2 or Tom's killer rule: No digits in the output (N1..N6) can appear in the input (I1..I6). -- this is the only rule that we've discussed that can actually be unsolvable -- if the input is 1,2,3,4,5,6 the target is 21 but if you can not use the digits 1,2,3,4,5,6 you can't get 21. I think that the smallest target that can be solved with this rule in force is 39 and the largest might be 267 but I'm not certain. What we're doing is creating a function that you can call from your current code In it's current form you would call GetSix and pass it the sum of I1-I6 called target and pass it 6 integer numbers N1..N6 which, if all goes well will contain the new digits and an integer CountLoop which, just for kicks returns the number of times the function had to go around the loop to create the result. The function is true if it's successful So you might call it like this If GetSix( I1+I2+I3+I4+I5+I6, N1, N2, N3, N4, N5, N6, loopCounter) ... do something the the good results else .. ask for new number because we failed endif Phil
report
• Wow, There is some really good stuff here, thank you for your involvement. Wow. Ok, the input number is a single entity not fed to each N1, N2, N3, N4 etc but to the group that now has to make six separate numbers with no two alike in the group or matches the group it got it’s fed number from, the order of the numbers in the set does not matter if one set of six numbers is 1,2,3,4,5,6 and the other is 2,3,4,5,6,1 the are still the same set. Does that make since? Each number generated has to be between 1 and 50. No two sets alike unless this is the only combination to get this sum of numbers. There are a few of those that can not be duplicated without the same set of 6 numbers, I believe.
report
• If this is the case then the program should exit out of the loop it might be in and except this as the only set.
report
• Since success now requires a comparison with the 6 input numbers The function call has been changed along with some cleanup of the rest.
```Public Function GetSix(ByVal I1 As Integer, ByVal I2 As Integer, ByVal I3 As Integer, _
ByVal I4 As Integer, ByVal I5 As Integer, ByVal I6 As Integer, _
ByRef N1 As Integer, ByRef N2 As Integer, ByRef N3 As Integer, _
ByRef N4 As Integer, ByRef N5 As Integer, ByRef N6 As Integer, _
ByRef CountLoop As Integer) As Boolean

Dim Success As Boolean = True
Dim rnd1 As New Random()
Dim target As Integer
Dim maxTries As Integer= 25000
Dim maxTriesRule5 As Integer = 15000

CountLoop = 0
target = I1 + I2 + I3 + I4 + I5 + I6

Do Until CountLoop > maxTries or Success

‘Loop
CountLoop += 1

N1 = rnd1.next(MAX( target - 240, 1), MIN( 50, target - 15) + 1 )
N2 = rnd1.next(MAX( target - N1 - 194, 1), MIN(50, target - 10 - N1) + 1)
N3 = rnd1.next(MAX( target - N1 - N2 - 147, 1), MIN(50, target - 6 - N1 - N2) + 1)
N4 = rnd1.next(MAX( target - N1 - N2 - N3 - 99, 1), MIN(50, target - 3 - N1 - N2 - N3) +1)
N5 = rnd1.next(MAX( target - N1 - N2 - N3 - N4 - 50, 1), MIN(50, target - 1 - N1 - N2 - N3 - N4) +1)
N6 = MAX( target - (N1 + N2 + N3 + N4 + N5), 1)

'----Rule 1, total of the inputs should equal the total of the outputs
Rule1 = (I1 + I2 + I3 + I4 + I5 + I6) = (N1 + N2 + N3 + N4 + N5 + N6)

'----Rule 2, N1, N2, N3, N4, N5, N6 must all be different
If Rule1
Rule2 =(N1 <> N2 And N1 <> N3 And N1 <> N4 And N1 <> N5 And _
N1 <> N6 And N2 <> N3 And N2 <> N4 And N2 <> N5 And _
N2 <> N6 And N3 <> N4 And N3 <> N5 And N3 <> N6 And _
N4 <> N5 And N4 <> N6 And N5 <> N6)
Endif

'----  Rule 3, N1 - N6 must be between 1 and 50
Rule3 = N6 > 0 and N6 <=50

'---- Rule 4, any digit cannot appear in the same location on the output as on the input N1 not equal to I1, N2 not equal to I2
if Rule1 and Rule2 and Rule3
Rule4 = (N1 <> I1 and N2 <> I2 and N3 <> I3 and N4 <> I4 and N5 <> I5 and N6 <> I6
Endif

'---- Rule 5, any digit cannot appear in the list if this is possible
if Rule1 and Rule3 and Rule3 and Rule4 and CountLoop < maxTriesRule5

Rule5 =(N1 <> I2 And N1 <> I3 And N1 <> I4 And N1 <> I5 And N1 <> I6 And_
N2 <> I1 And N2 <> I3 And N2 <> I4 And N2 <> I5 AND N2 <> I6 And_
N3 <> I1 And N3 <> I2 And N3 <> I4 And N3 <> I5 And N3 <> I6 And_
N4 <> I1 And N4 <> I2 And N4 <> I3 And N4 <> I5 And N4 <> I6 And_
N5 <> I1 And N5 <> I2 And N5 <> I3 And N5 <> I4 And N5 <> I6 And_
N6 <> I1 And N6 <> I2 And N6 <> I3 And N6 <> I4 And N6 <> I6 )
Endif

'---- test success
If   (Rule1 and Rule2 and Rule3 and Rule4 and Rule5)
or (Rule1 and Rule2 and Rule3 and Rule4 and LoopCount> maxTriesRule5 )
Success = True
Else
Success = False
Endif
loop
Return Success
End Function

```
report
• Finder .. hope one of our VB resouces pick this up The addition of rules 5 and 6 changed the interface .. now it would be called something like this
```If GetSix( I1, I2, I3, I4, I5. I6, N1, N2, N3, N4, N5, N6, loopCounter)
… do something the the good results
else
.. ask for new number because we failed
endif
```
report
• Correction 01.28.12 -001 add Dim Rule1, Rule2, Rule3, Rule4, Rule5 as Boolean
report
• Correction 01.28.12 -002 bad entry values add immediately after computing target If target < 21 ot target > 285 then return false endif add then on all if ... statements
report
• Thread continued on Need a little VB.Net help -2
report
• For some reason I have not been being updated to this thread when someone replies. Why is that? How can I now go back and subscribe to this thread manually so I will be in the loop of notices when anyone replies?
report
• report
• report
• Here's the link to the new thread: Need a little VB.Net help -2
report
• This sucks, I don’t have or can’t find the “Add to my Watch list” button and for some reason it’s not doing it automatically as it used to do.
report
• I don’t have or can’t find the “Add to my Watch list” button... Try the browser Ctrl-F ('Find') function to find "watch" on the page. Or use Phil's profile to track where he's been hanging out. Tom
report
• Tom track where he’s been hanging out. Do I have the video-cam on again? Phil
report
• Phil, You thought that the red light going off meant that the cam was inactive, eh? Tom
report
• don't look, I'm in the shower! do look at this tag. https://itknowledgeexchange.techtarget.com/itanswers/for-discussion-are-we-helping-ourselves-out-of-a-job/ Phil
report 