TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
anjumathi kumar
NA
54
64.2k
How can i generate different unique string in different length
Jun 23 2011 6:18 AM
{
public
static
string
createRandomString(
int
Length)
string
_allowedChars =
"abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ"
;
Random
randNum =
new
Random
();
int
outputLength = (
int
)(randNum.NextDouble() * Length);
//<<<<<<<<< moved out of loop
char
[] chars =
new
char
[outputLength];
//<<<<<<<< use outputLength here
// not used int allowedCharCount = _allowedChars.Length;
{
chars[i] = _allowedChars[(
}
}
for
(
int
i = 0; i < outputLength; i++)
int
)((_allowedChars.Length) * randNum.NextDouble())];
return
new
string
(chars);
Hi,
This code generates same string some time and different string some time
this is random generate code function.
how can i change if i want different string in different length always?
Reply
Answers (
5
)
How to add scrollbar within gridview?
Validation multiple group on sinle button click