Problem generating unique alpha-numeric number en mass

Need to generate 500 unique alpha-numeric values

Page 1 of 1

1 Replies - 3550 Views - Last Post: 04 March 2008 - 09:59 AM Rate Topic: -----

#1 ChaosEdict  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 02-March 08

Problem generating unique alpha-numeric number en mass

Post icon  Posted 02 March 2008 - 05:40 PM

I am in need of help. I have a working generator for 6 digit alpha-numeric numbers, here is the clincher, i need to generate 500 unique values on form load to populate a listbox. When i attempt to put it on a loop, it just generates the same number over and over again. Any ideas?

Dim rand As New Random 
Dim int As Integer 
Dim count As Integer 
Dim counter As Integer = 0 
Dim pass As String = "" 

Do Until counter = 500 
Do Until count = 6 
int = rand.Next(2) 
If int = 1 Then 
pass = pass & alpha(rand.Next(25)) 
Else 
pass = pass & numeric(rand.Next(9)) 
End If 
count = count + 1 
Loop 
ListBox1.Items.Add(pass) 
pass = "" 
counter = counter + 1 
Loop 



Alpha() and Numeric() have already been populated with the appropriate vaules.

~Mac

Is This A Good Question/Topic? 0
  • +

Replies To: Problem generating unique alpha-numeric number en mass

#2 ChaosEdict  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 02-March 08

Re: Problem generating unique alpha-numeric number en mass

Posted 04 March 2008 - 09:59 AM

I figured out the problem, the trouble was that i had placed the code under a button, that and i forgot to put the variable count back to zero.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1