LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Bash: Generating a random LETTERS sequence (https://www.linuxquestions.org/questions/programming-9/bash-generating-a-random-letters-sequence-880311/)

iniuria 05-12-2011 08:48 AM

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.

grail 05-12-2011 09:05 AM

Pick your favourite language, check out the ASCII values for each character and go for it.

SigTerm 05-12-2011 09:09 AM

Quote:

Originally Posted by iniuria (Post 4354317)
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.

jlinkels 05-12-2011 12:49 PM

http://tools.arantius.com/password

jlinkels


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