By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,645 Members | 1,065 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,645 IT Pros & Developers. It's quick & easy.

random word generator

P: n/a
Hello folks...

this is my first post in here. I'm new to ASP having done all my previous
work in Flash and bog standard HTML. Only been learning for a couple of
weeks.

anyway...I have been building a guestbook type page, but as with quite a lot
of guestbooks and stuff some of the comments that get placed are not exactly
suitable, and tracking people down is a little difficult.

maybe you all can think of much better ways but remember I'm a newbie and am
working my way through..

so...

I have a form where people sign up to become a member..they select their
name and password etc and can log in, but this is completely anonymous....

so..I got an email script set up and working (took me a long time to figure
that one out!!!) and connected to a dbase, The user gives me his email addy
and name and a random number is generated, stored as his password and the
password is mailed to him,...thus if he doesn't give me a corect email addy
he doesn't get his password and therefore can't sign in or post nasty
comments..

But a number password isn't really all that and I would prefer to have a
random word generated.

is this possible??

again, being a newbie and not very up on what I can/can't do...I thought of
the following...

1) Store a bunch of words in a text file with a space between each one
2) Read in this file and store it as a variable
3) Trim off a random number of characters from the start of the text
4) Then search for the next space (which would be the beginning of the next
complete word)
5) The next space after that would then mark the end of the word
6) count the characters between the two spaces to give me the word length
7) and then select that number of characters and then I have a randomly
selected word!!!

I can't see why it wouldn't work as it seems logical to me, but maybe
someone (Ray seems to be the god of ASP (I've been reading here for a couple
of weeks and he seems to know everything!!!!)... can tell me otherwise?

many thanks


Jul 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Alistair,

maybe something like this

<%
words="cat dog fruit banana"
wordarr = split(words," ")

randomize
randomword=wordarr(int(rnd * ubound(wordarr)))

response.write(randomword)
%>
/Lasse

"Alistair" <em***@wormfilteralistair.inuk.com> wrote in message
news:vo************@corp.supernews.com...
Hello folks...

this is my first post in here. I'm new to ASP having done all my previous
work in Flash and bog standard HTML. Only been learning for a couple of
weeks.

anyway...I have been building a guestbook type page, but as with quite a lot of guestbooks and stuff some of the comments that get placed are not exactly suitable, and tracking people down is a little difficult.

maybe you all can think of much better ways but remember I'm a newbie and am working my way through..

so...

I have a form where people sign up to become a member..they select their
name and password etc and can log in, but this is completely anonymous....

so..I got an email script set up and working (took me a long time to figure that one out!!!) and connected to a dbase, The user gives me his email addy and name and a random number is generated, stored as his password and the
password is mailed to him,...thus if he doesn't give me a corect email addy he doesn't get his password and therefore can't sign in or post nasty
comments..

But a number password isn't really all that and I would prefer to have a
random word generated.

is this possible??

again, being a newbie and not very up on what I can/can't do...I thought of the following...

1) Store a bunch of words in a text file with a space between each one
2) Read in this file and store it as a variable
3) Trim off a random number of characters from the start of the text
4) Then search for the next space (which would be the beginning of the next complete word)
5) The next space after that would then mark the end of the word
6) count the characters between the two spaces to give me the word length
7) and then select that number of characters and then I have a randomly
selected word!!!

I can't see why it wouldn't work as it seems logical to me, but maybe
someone (Ray seems to be the god of ASP (I've been reading here for a couple of weeks and he seems to know everything!!!!)... can tell me otherwise?

many thanks

Jul 19 '05 #2

P: n/a

"Lasse Edsvik" <la***@nospam.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Alistair,

maybe something like this

<%
words="cat dog fruit banana"
wordarr = split(words," ")

randomize
randomword=wordarr(int(rnd * ubound(wordarr)))

response.write(randomword)
%>
/Lasse

perfect, Many thanks

an array was going to be the other method that I thought of and I forgot
about the split function....part of being a newbie is that you easily forget
the little commands in favour of the far more exciting big commands.

Jul 19 '05 #3

P: n/a
Why not use a random number itself as a passcode?

--
Manohar Kamath
Editor, .netBooks
www.dotnetbooks.com
"Alistair" <em***@wormfilteralistair.inuk.com> wrote in message
news:vo************@corp.supernews.com...
Hello folks...

this is my first post in here. I'm new to ASP having done all my previous
work in Flash and bog standard HTML. Only been learning for a couple of
weeks.

anyway...I have been building a guestbook type page, but as with quite a lot of guestbooks and stuff some of the comments that get placed are not exactly suitable, and tracking people down is a little difficult.

maybe you all can think of much better ways but remember I'm a newbie and am working my way through..

so...

I have a form where people sign up to become a member..they select their
name and password etc and can log in, but this is completely anonymous....

so..I got an email script set up and working (took me a long time to figure that one out!!!) and connected to a dbase, The user gives me his email addy and name and a random number is generated, stored as his password and the
password is mailed to him,...thus if he doesn't give me a corect email addy he doesn't get his password and therefore can't sign in or post nasty
comments..

But a number password isn't really all that and I would prefer to have a
random word generated.

is this possible??

again, being a newbie and not very up on what I can/can't do...I thought of the following...

1) Store a bunch of words in a text file with a space between each one
2) Read in this file and store it as a variable
3) Trim off a random number of characters from the start of the text
4) Then search for the next space (which would be the beginning of the next complete word)
5) The next space after that would then mark the end of the word
6) count the characters between the two spaces to give me the word length
7) and then select that number of characters and then I have a randomly
selected word!!!

I can't see why it wouldn't work as it seems logical to me, but maybe
someone (Ray seems to be the god of ASP (I've been reading here for a couple of weeks and he seems to know everything!!!!)... can tell me otherwise?

many thanks

Jul 19 '05 #4

P: n/a
Try this Alistair.

Function CreatePassword (Length)

Dim Count
Dim Password
Dim ValidLength
Const Valid =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvw xyz1234567890"

Password = ""
ValidLength = Len (Valid)
Randomize

' We want a password that is 'Length' characters long.
For Count = 1 To Length
Password = Password & Mid (Valid, (Int (Rnd * ValidLength) + 1), 1)
Next

CreatePassword = Password

End Function

Regards,

Alan

"Alistair" <em***@wormfilteralistair.inuk.com> wrote in message
news:vo************@corp.supernews.com...
Hello folks...

this is my first post in here. I'm new to ASP having done all my previous
work in Flash and bog standard HTML. Only been learning for a couple of
weeks.

anyway...I have been building a guestbook type page, but as with quite a lot of guestbooks and stuff some of the comments that get placed are not exactly suitable, and tracking people down is a little difficult.

maybe you all can think of much better ways but remember I'm a newbie and am working my way through..

so...

I have a form where people sign up to become a member..they select their
name and password etc and can log in, but this is completely anonymous....

so..I got an email script set up and working (took me a long time to figure that one out!!!) and connected to a dbase, The user gives me his email addy and name and a random number is generated, stored as his password and the
password is mailed to him,...thus if he doesn't give me a corect email addy he doesn't get his password and therefore can't sign in or post nasty
comments..

But a number password isn't really all that and I would prefer to have a
random word generated.

is this possible??

again, being a newbie and not very up on what I can/can't do...I thought of the following...

1) Store a bunch of words in a text file with a space between each one
2) Read in this file and store it as a variable
3) Trim off a random number of characters from the start of the text
4) Then search for the next space (which would be the beginning of the next complete word)
5) The next space after that would then mark the end of the word
6) count the characters between the two spaces to give me the word length
7) and then select that number of characters and then I have a randomly
selected word!!!

I can't see why it wouldn't work as it seems logical to me, but maybe
someone (Ray seems to be the god of ASP (I've been reading here for a couple of weeks and he seems to know everything!!!!)... can tell me otherwise?

many thanks

Jul 19 '05 #5

P: n/a
We use much the same function - with the exception that we remove the
vowels. This way, you don't "randomly" create inappropriate text. We also
double the string to flatten the selection curve.

--
William Morris
Product Development, Seritas LLC

"Alan" <Xa*************@XparadiseX.XnetX.XnzX> wrote in message
news:#z**************@TK2MSFTNGP10.phx.gbl...
Try this Alistair.

Function CreatePassword (Length)

Dim Count
Dim Password
Dim ValidLength
Const Valid =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvw xyz1234567890"

Password = ""
ValidLength = Len (Valid)
Randomize

' We want a password that is 'Length' characters long.
For Count = 1 To Length
Password = Password & Mid (Valid, (Int (Rnd * ValidLength) + 1), 1)
Next

CreatePassword = Password

End Function

Regards,

Alan

"Alistair" <em***@wormfilteralistair.inuk.com> wrote in message
news:vo************@corp.supernews.com...
Hello folks...

this is my first post in here. I'm new to ASP having done all my previous work in Flash and bog standard HTML. Only been learning for a couple of
weeks.

anyway...I have been building a guestbook type page, but as with quite a lot
of guestbooks and stuff some of the comments that get placed are not

exactly
suitable, and tracking people down is a little difficult.

maybe you all can think of much better ways but remember I'm a newbie and am
working my way through..

so...

I have a form where people sign up to become a member..they select their
name and password etc and can log in, but this is completely

anonymous....
so..I got an email script set up and working (took me a long time to

figure
that one out!!!) and connected to a dbase, The user gives me his email

addy
and name and a random number is generated, stored as his password and the password is mailed to him,...thus if he doesn't give me a corect email

addy
he doesn't get his password and therefore can't sign in or post nasty
comments..

But a number password isn't really all that and I would prefer to have a
random word generated.

is this possible??

again, being a newbie and not very up on what I can/can't do...I thought

of
the following...

1) Store a bunch of words in a text file with a space between each one
2) Read in this file and store it as a variable
3) Trim off a random number of characters from the start of the text
4) Then search for the next space (which would be the beginning of the

next
complete word)
5) The next space after that would then mark the end of the word
6) count the characters between the two spaces to give me the word length 7) and then select that number of characters and then I have a randomly
selected word!!!

I can't see why it wouldn't work as it seems logical to me, but maybe
someone (Ray seems to be the god of ASP (I've been reading here for a

couple
of weeks and he seems to know everything!!!!)... can tell me otherwise?

many thanks


Jul 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.