generating passwords question

  • Thread starter Pierre via OfficeKB.com
  • Start date
P

Pierre via OfficeKB.com

Hi,

I have the following code to generate random passwords:

Sub passgen()
Dim k As Long
With Sheets(Licentie)

For k = 1 To 6
For a = 1 To 1000
X = Int(Rnd * 2)
If X = 1 Then
Cells(a, k) = Chr(Int(26 * Rnd) + 65)
Else
Cells(a, k) = Int(9 * Rnd)
End If
Next a
Next k
End With
End Sub

The code puts random numbers and figures in column 1-6.
in column 7 i put the values of column 1-6 together to get a password.
However, the passwords are not unique...
How can i make the passwords unique?
Thanks,
Pierre
 
G

Guest

your algorithm doesn't allow you to generate that many "unique" values.

You have 6 x 1000, ie 6000 potential values but for about 1/2 the time you
just use a letter from A to z, so 3000 values use just one of 26 letters.
 
P

Pierre via OfficeKB.com

hi patrick,

do you have some additional code so that i can generate unique codes please?
thanks,
Pierre

Patrick said:
your algorithm doesn't allow you to generate that many "unique" values.

You have 6 x 1000, ie 6000 potential values but for about 1/2 the time you
just use a letter from A to z, so 3000 values use just one of 26 letters.
[quoted text clipped - 23 lines]
Thanks,
Pierre
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top