Random Letters
-
- Newbie
- Posts: 5
- Joined: Tue Oct 25, 2005 5:25 pm
- Location: U.S.A.
- Contact:
Random Letters
How can I make the program generate random letters instead of just random numbers?
Willi@m C.
-
- Veteran
- Posts: 1055
- Joined: Sun Jan 02, 2005 2:11 pm
- Location: At my computer
- Contact:
By making random numbers from 41-90 (Caps) and 61-122 (Lower Case), then use the CHR$() to return the letter value of the numbers.. =)
btw, to get a range(e.g. 3 to 10) of random numbers:
btw, to get a range(e.g. 3 to 10) of random numbers:
Code: Select all
RandNum = INT(RND * (UPPER - LOWER + 1)) + LOWER
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)
(x.t.r.GRAPHICS)
Try this quick lil function I just whipped up here in the forum editbox:
Code: Select all
FUNCTION RNDLETTER() AS STRING
DIM A AS INTEGER, B AS INTEGER
A = INT(RND(1) * 26)
B = INT(RND(1) * 2)
IF B = 1 THEN
RNDLETTER = CHR$(97 + A)
ELSE
RNDLETTER = CHR$(65 + A)
END IF
END FUNCTION
i made a language program that randomly
picks consanants and vowels if you want it
i can send it to you...
from a beginners programming try....
basically what i did:
was write a vowel file(6)
write a consanant file(20)
then i randomly make a marker(1-20) or (1-6)
go in each file to that spot and
grab the letter...
it makes a 2900 word dictionary ALL 5 letter words
and makes a fake langauge
picks consanants and vowels if you want it
i can send it to you...
from a beginners programming try....
basically what i did:
was write a vowel file(6)
write a consanant file(20)
then i randomly make a marker(1-20) or (1-6)
go in each file to that spot and
grab the letter...
it makes a 2900 word dictionary ALL 5 letter words
and makes a fake langauge
Very nice, Nek, I like it.Nekrophidius wrote:Try this quick lil function I just whipped up here in the forum editbox:
Code: Select all
FUNCTION RNDLETTER() AS STRING DIM A AS INTEGER, B AS INTEGER A = INT(RND(1) * 26) B = INT(RND(1) * 2) IF B = 1 THEN RNDLETTER = CHR$(97 + A) ELSE RNDLETTER = CHR$(65 + A) END IF END FUNCTION
You used a different syntax of RND to get random numbers between 0 and 25 and between 0 and 1. It's different, but it works.
*****
If you are ahead of me, lead.
If you are behind me, follow.
If you are not doing anything,
Get out of the way.
If you are behind me, follow.
If you are not doing anything,
Get out of the way.
Random names
I wrote a program in QuickBasic to generate a list of random names and associated random email addresses (as spam bait). You can find the output here: http://www.chibardun.net/~zim/friends.htm
I downloaded a list of the most popular boys/girls/sur- names from the government's census bureau web site and build my program around that. I'll be happy to email the code to any interested party.
I downloaded a list of the most popular boys/girls/sur- names from the government's census bureau web site and build my program around that. I'll be happy to email the code to any interested party.
--- Zim ---
--- Time flies like an arrow, but fruit flies like a banana ---
--- Time flies like an arrow, but fruit flies like a banana ---