473,396 Members | 1,760 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,396 software developers and data experts.

random word generator

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
5 8504
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

"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
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
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
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 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...
18
by: Toby Newman | last post by:
I need to randomly choose one of four paths in my program. Using the tools I know, the best way I can think to do it is by doing something like the following: //==============================...
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...
10
by: muttaa | last post by:
Hi everybody, May i know how to write a code that generates random numbers as many times as one would want ? i.e. like the standard function 'rand()' or may i get the basic logic behind it ? ...
1
by: gry | last post by:
I want a function (or callable something) that returns a random word meeting a criterion. I can do it like: def random_richer_word(word): '''find a word having a superset of the letters of...
12
by: Pascal | last post by:
hello and soory for my english here is the query :"how to split a string in a random way" I try my first shot in vb 2005 express and would like to split a number in several pieces in a random way...
26
by: bilgekhan | last post by:
What is the correct method for generating 2 independent random numbers? They will be compared whether they are equal. What about this method: srand(time(0)); int r1 = rand(); srand(rand());...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.