Page 1 of 1

Random Letters

Posted: Fri Nov 18, 2005 6:05 pm
by qbfreak2000
How can I make the program generate random letters instead of just random numbers?

Posted: Fri Nov 18, 2005 6:18 pm
by Rattrapmax6
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:

Code: Select all

RandNum = INT(RND * (UPPER - LOWER + 1)) + LOWER
:wink:

Posted: Fri Nov 18, 2005 9:04 pm
by Nodtveidt
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

Posted: Sat Nov 19, 2005 11:20 am
by sid6.7
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

Posted: Sat Nov 19, 2005 3:19 pm
by moneo
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
Very nice, Nek, I like it.
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.
*****

Random names

Posted: Mon Dec 12, 2005 11:51 am
by Zim
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.