Fill up string array with random characters?
Collapse
This topic is closed.
X
X
-
pedestrian via DotNetMonster.comTags: None -
GhostInAK
Re: Fill up string array with random characters?
Hello pedestrian via DotNetMonster.c om,
Create an array of the characters you want to fill from. Then check out
the Ssytem.Random class.
-Boo
Let's say I declares an array of string (of size 1000), how to fill
every elements of it with random characters?
>
Dim myStrArray(999) As String
..
Thanks...
>
Message posted via DotNetMonster.c om
http://www.dotnetmonster.com/Uwe/For...b-net/200608/1
-
Jay B. Harlow [MVP - Outlook]
Re: Fill up string array with random characters?
Pedestrian, Penang
In addition to the other comments:
How long do you want each string?
How random do you want each string?
To get random "password" keys (WEP Keys) I will use
RNGCryptoServic eProvider.GetNo nZeroBytes:
http://msdn2.microsoft.com/en-us/lib...zerobytes.aspx
Followed by BitConverter.To String:
http://msdn2.microsoft.com/en-us/library/3a733s97.aspx
If you don't want or need a cryptographical ly strong sequence of values, you
could use System.Random in a loop. Just remember to create the new
System.Random object outside the loop then call its Next method inside the
loop:
http://msdn2.microsoft.com/en-us/lib...em.Random.aspx
I would use the Random.Next method that accepted a range of values...
passing in Char code points
--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"pedestrian via DotNetMonster.c om" <u16758@uwewrot e in message
news:64c80eac0a 1a0@uwe...
| Let's say I declares an array of string (of size 1000),
| how to fill every elements of it with random characters?
|
| Dim myStrArray(999) As String
| ..
|
| Thanks...
|
| --
| Pedestrian, Penang.
|
| Message posted via DotNetMonster.c om
| http://www.dotnetmonster.com/Uwe/For...b-net/200608/1
|
Comment
-
pedestrian via DotNetMonster.com
Re: Fill up string array with random characters?
Thanks for replying... Mr Jay
I would like to use the strings to insert values to database columns...
such as FirstName, LastName, Address etc.. columns...
Jay B. Harlow [MVP - Outlook] wrote:-->Pedestrian, Penang
>In addition to the other comments:
>
>How long do you want each string?
>
>How random do you want each string?
>
>To get random "password" keys (WEP Keys) I will use
>RNGCryptoServi ceProvider.GetN onZeroBytes:
>
>http://msdn2.microsoft.com/en-us/lib...zerobytes.aspx
>
>Followed by BitConverter.To String:
>
>http://msdn2.microsoft.com/en-us/library/3a733s97.aspx
>
>If you don't want or need a cryptographical ly strong sequence of values, you
>could use System.Random in a loop. Just remember to create the new
>System.Rando m object outside the loop then call its Next method inside the
>loop:
>
>http://msdn2.microsoft.com/en-us/lib...em.Random.aspx
>
>I would use the Random.Next method that accepted a range of values...
>passing in Char code points
>
>| Let's say I declares an array of string (of size 1000),
>| how to fill every elements of it with random characters?
>[quoted text clipped - 3 lines]
>|
>| Thanks...
Pedestrian, Penang.
Message posted via DotNetMonster.c om
Best online pokies for real money in Australia and learn about safety and game mechanics in this comprehensive guide.
Comment
Comment