LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 05-12-2011, 08:48 AM   #1
iniuria
LQ Newbie
 
Registered: Mar 2010
Posts: 4

Rep: Reputation: 0
Bash: Generating a random LETTERS sequence


Hi, everyone. I tried googling around but i cant find anything related to this: everyone seems just interested in random numbers, so when it comes to random letters there is a lack of informations.

However, i am trying to figure out a wait to get a random letters string that matches a simple rule: it must be a sequence of consonant+vowel. So for example, these are some 6 letters strings i would like to obtain: wolupa, tafoke, zewevu, cupimo.

I dont really need a full script, a one-liner would be very appreciated.
Thanks to anyone willing to help.
 
Old 05-12-2011, 09:05 AM   #2
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,428

Rep: Reputation: 1878Reputation: 1878Reputation: 1878Reputation: 1878Reputation: 1878Reputation: 1878Reputation: 1878Reputation: 1878Reputation: 1878Reputation: 1878Reputation: 1878
Pick your favourite language, check out the ASCII values for each character and go for it.
 
Old 05-12-2011, 09:09 AM   #3
SigTerm
Member
 
Registered: Dec 2009
Distribution: Slackware 12.2
Posts: 379

Rep: Reputation: 233Reputation: 233Reputation: 233
Quote:
Originally Posted by iniuria View Post
Hi, everyone. I tried googling around but i cant find anything related to this: everyone seems just interested in random numbers, so when it comes to random letters there is a lack of informations.

However, i am trying to figure out a wait to get a random letters string that matches a simple rule: it must be a sequence of consonant+vowel. So for example, these are some 6 letters strings i would like to obtain: wolupa, tafoke, zewevu, cupimo.

I dont really need a full script, a one-liner would be very appreciated.
Thanks to anyone willing to help.
You have an endless supply of pseudo-random characters in /dev/urandom, so you could use something like that:
Code:
cat /dev/urandom| tr -dc '0-9a-zA-Z!@#$%^&*_+-'|head -c 8
To get absolutely meaningless and unpronounceable sequence of letters.

You could also prepare array of letter pairs, and select several letter combinations using random index within array.

Using a large english text, you could generate frequency frequency tables, then generate a word using frequency tables. You can easily find few name generators on the internet (some of them are written in python) that work this way.

By the way, before generating readable words, you may want to read about automated curse generator. Just in case.
 
Old 05-12-2011, 12:49 PM   #4
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,053

Rep: Reputation: 484Reputation: 484Reputation: 484Reputation: 484Reputation: 484
http://tools.arantius.com/password

jlinkels
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] generating series of numbers of sequence vjramana Programming 7 03-19-2011 10:34 AM
generating random numbers in C abk4523 Programming 20 01-10-2011 04:08 PM
[SOLVED] Finding and deleting a sequence of letters geodave0110 Linux - Newbie 3 12-08-2010 01:14 PM
How to generate random letters only SentralOrigin Linux - Software 13 08-24-2010 07:58 PM
random letters pixellany Programming 15 07-14-2007 08:05 AM


All times are GMT -5. The time now is 06:47 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration