Re: Fast way to generate unique strings
From: Doug Glancy (nobodyhere_at_replytogroup.com)
Date: 10/26/04
- Next message: antonio: "Textbox-read text line by line"
- Previous message: R Avery: "How to trap the OnAction of a CommandBarPopup"
- In reply to: R Avery: "Fast way to generate unique strings"
- Next in thread: JE McGimpsey: "Re: Fast way to generate unique strings"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 26 Oct 2004 09:37:56 -0700
I'm curious to see what you've been using.
Doug Glancy
"R Avery" <ravery74@yahoo.co.uk> wrote in message
news:ul2IpS3uEHA.1448@TK2MSFTNGP10.phx.gbl...
> what is the fastest VBA code to generate a list of random strings of a
> specified length.
>
> the function prototype i want is
>
> sub GetUniqueStrings(Strings() as string, Length as long)
>
>
> The one i had been using seems slow when using it to generate lots of
> strings, and i was wondering if there was a way to speed it up. Thanks!
>
>
>
>
> Public Function GetUniqueString(ByVal NumChars As Long) As String
> Dim i As Long, str As String
>
> GetUniqueString = Space$(NumChars)
>
> For i = 1 To NumChars
> Mid$(GetUniqueString, i, 1) = Chr(RandBetween(97, 122))
> Next i
>
> End Function
>
> Public Function RandBetween(ByVal LB As Long, ByVal UB As Long) As Long
> RandBetween = LB + Round(Rnd * (UB - LB), 0)
> End Function
- Next message: antonio: "Textbox-read text line by line"
- Previous message: R Avery: "How to trap the OnAction of a CommandBarPopup"
- In reply to: R Avery: "Fast way to generate unique strings"
- Next in thread: JE McGimpsey: "Re: Fast way to generate unique strings"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|