Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default generating passwords question

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


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200511/1
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default generating passwords question

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.

"Pierre via OfficeKB.com" wrote:

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


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200511/1

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default generating passwords question

hi patrick,

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

Patrick Molloy wrote:
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.

Hi,

[quoted text clipped - 23 lines]
Thanks,
Pierre



--
Message posted via http://www.officekb.com
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passwords Lillian[_2_] Excel Discussion (Misc queries) 6 July 30th 07 01:32 PM
Passwords Manos Excel Discussion (Misc queries) 1 February 9th 05 12:08 PM
passwords [email protected] Excel Programming 1 February 3rd 05 08:04 PM
Passwords ammader Excel Programming 0 December 22nd 03 02:41 PM
Passwords pajodublin Excel Programming 2 November 18th 03 01:39 PM


All times are GMT +1. The time now is 05:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"