1 Replies - 643 Views - Last Post: 22 August 2013 - 02:49 PM Rate Topic: -----

#1 kyle_denney  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 171
  • Joined: 10-August 12

Looping Question

Posted 22 August 2013 - 02:42 PM

I am trying to find the easiest way to do the following:

I have pseudo-code but think it needs some optimization.

The pseudo-code I think one could use is something like this

Dim resultNeeded = 123

Dim x = 0
Dim y = 0

For x as int16 = 0 to 1000
For y as int16 = 0 to 1000

Perform some quick calculation in here to get resultNeeded


What is inside the loop does not matter. What I am wanting to know is to see if the above loop is the best way to iterate through the two combinations of 1000 or is there a quicker way in VB.Net or C#. Thanks!

Basically set up two variables x, y such that each number is iterated through a loop all the way up to 1000 for both x and y running an algorithm on the result to see if it matches a certain criteria.

I am trying to run an algorithm that when using two numbers between 0-1000 will give a certain output - lets say a key like ACD123-45232.

All I am wanting to know is how to iterate through the two sets of 0-1000 the fastest way and run the algorithm through each iteration to test if it matches the value like above. The algorithm doesn't matter and I know in VB.Net you can use a For Each/Next scenario taking each number and looping it against the other number but I feel there has to be a better way. Any advice is appreciated. Thanks! - Remember any actual code is VB.Net or C#. Thanks!

Is This A Good Question/Topic? 0
  • +

Replies To: Looping Question

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon

Reputation: 13348
  • View blog
  • Posts: 53,167
  • Joined: 12-June 08

Re: Looping Question

Posted 22 August 2013 - 02:49 PM

Yes.. that would be the most straight forward. So.. trying to brute force a key? Office product keys?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1