473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Random number/letter generator

Is there a good random number/letter generator out there?

I just want to be able to generate a password that has letters and or
numbers about 10 characters long.

Thanks,

Tom
Nov 19 '05 #1
3 2178
How about System.Random?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"tshad" <ts**********@ftsolutions.com> wrote in message
news:ue**************@TK2MSFTNGP10.phx.gbl...
Is there a good random number/letter generator out there?

I just want to be able to generate a password that has letters and or
numbers about 10 characters long.

Thanks,

Tom

Nov 19 '05 #2
> How about System.Random?

I don't think this implementation is sufficient for cryptographic purposes.
Check out System.Security.Cryptography.RandomNumberGenerator and the RNGCryptoServiceProvider
implementation.

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #3
"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:66**********************@msnews.microsoft.com ...
How about System.Random?
I don't think this implementation is sufficient for cryptographic
purposes. Check out System.Security.Cryptography.RandomNumberGenerator and
the RNGCryptoServiceProvider implementation.


I'll check that out.

What I came up with temporarily was:

************************************************** ********
Function RandomNumber(min as Integer, max as Integer) as integer
Dim random as Random = new Random()
RandomNumber = random.Next(min, max)
End Function

Function RandomString(size as integer, lowerCase as boolean) as string
Dim builder as StringBuilder = new StringBuilder()
Dim random as Random = new Random()
Dim i as integer
dim ch as char

for i = 0 to size -1
ch = Convert.ToChar(Convert.ToInt32(25 * random.NextDouble() + 65))
random.NextDouble()
builder.Append(ch)
next
if(lowerCase) then RandomString = builder.ToString().ToLower()

RandomString = builder.ToString()
end function
************************************************** **************

I would then do the following:

Dim builder as StringBuilder = new StringBuilder()
builder.Append(RandomString(6, false))
builder.insert(3,RandomNumber(0, 10))

password1.text = builder.ToString()

This seems to do what I want, at least for now.

Thanks,

Tom
-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Brandon Michael Moore | last post by:
I'm trying to test a web application using a tool written in python. I would like to be able to generate random values to put in fields. I would like to be able to generate random dates (in a...
3
by: Joe | last post by:
Hi, I have been working on some code that requires a high use of random numbers within. Mostly I either have to either: 1) flip a coin i.e. 0 or 1, or 2) generate a double between 0 and 1. I...
70
by: Ben Pfaff | last post by:
One issue that comes up fairly often around here is the poor quality of the pseudo-random number generators supplied with many C implementations. As a result, we have to recommend things like...
5
by: Peteroid | last post by:
I know how to use rand() to generate random POSITIVE-INTEGER numbers. But, I'd like to generate a random DOUBLE number in the range of 0.0 to 1.0 with resolution of a double (i.e., every possible...
104
by: fieldfallow | last post by:
Hello all, Is there a function in the standard C library which returns a prime number which is also pseudo-random? Assuming there isn't, as it appears from the docs that I have, is there a...
12
by: Jim Michaels | last post by:
I need to generate 2 random numbers in rapid sequence from either PHP or mysql. I have not been able to do either. I get the same number back several times from PHP's mt_rand() and from mysql's...
11
by: Olaf \El Blanco\ | last post by:
How can i generate random words? ('a'..'z') Is there any function that convert a number to it ascci char? My english is horrible! Here an example: function(65) return 'a'; Thank you!
4
by: darrel | last post by:
I can grab a random number in vb.net like this: Dim RandomClass As New Random Dim RandomNumber As Integer RandomNumber = RandomClass.Next(1, 26) However, what I want is a random number. Short...
11
TTCEric
by: TTCEric | last post by:
This will be original. I promise. I cannot get the random number generator to work. I tried seeding with Date.Now.Milliseconds, it still results in the same values. What I have are arrays...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.