Page 1 of 3 123 LastLast
Results 1 to 10 of 24
  1. #1
    Uneqfglyr, shpx lrnu ubergeek85's Avatar
    Join Date
    Feb 2005
    Location
    122.61.131.xx
    Posts
    2,952

    Default Mass word generator

    Hi all. I'm looking for a program to generate random words/strings. I've been googling, but haven't found much freeware. It has to be able to generate words to a filter (eg: llnnllnn = ah78yr88) en masse. Can anyone suggest anything? Thanks.
    ........,-O
    .......O(_)) ubuntu 11.04 because I'm insane
    ........`-O

    Quote Originally Posted by Jen View Post
    I think I scare ubergeek85. His first words to me were 'you banned me'.

  2. #2
    Member
    Join Date
    Dec 2004
    Location
    NZ
    Posts
    44,851

    Default Re: Mass word generator

    I have no idea what youre talking about

  3. #3
    Uneqfglyr, shpx lrnu ubergeek85's Avatar
    Join Date
    Feb 2005
    Location
    122.61.131.xx
    Posts
    2,952

    Default Re: Mass word generator

    I'll admit, it's a bit hard to explain. I'm after a program that generates lots of random strings, can save thise strings to a text file, and I can change how it generates the string, eg the first char has to be a letter, second char has to be a number, etc.

    Make sense? I almost put myself to sleep.
    ........,-O
    .......O(_)) ubuntu 11.04 because I'm insane
    ........`-O

    Quote Originally Posted by Jen View Post
    I think I scare ubergeek85. His first words to me were 'you banned me'.

  4. #4
    Gone Erayd's Avatar
    Join Date
    Dec 2004
    Location
    Wellington, NZ
    Posts
    5,761

    Default Re: Mass word generator

    I could write that in my sleep. Is Linux-based OK?
    If you are interested in reading fanfiction on a mobile device or ebook reader, please visit flagfic.com.

  5. #5
    Senior Bantu's Avatar
    Join Date
    May 2007
    Location
    In My Auckland Office
    Posts
    2,009

    Default Re: Mass word generator

    Search Lorem Ipsum
    It is a random generator. There are quite a few online generators.

    http://www.lipsum.com/

    Lorem Ipsum is simply dummy text of the printing and typesetting industry.
    Thermaltake Armor Case/1100W PSU
    Gigabyte GA-X58A-UD3R Motherboard i7-960 3.2 GHz
    Gigabyte GV-N670OC-4GD GForce GTX-670
    Corsair 4x8GB, DDR3-1600 32GB
    5 x Seagate HDD's 3.0TB each
    Dual 22" ViewSonic Widescreen
    NexStar Dual SATA Dock

  6. #6
    Senior Member
    Join Date
    May 2008
    Location
    Auckland
    Posts
    186

    Default Re: Mass word generator

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Random Word Generator</title>
        <script language="javascript" type="text/javascript">
    
            var validCharacters = new Array();
            validCharacters[0] = "a";
            validCharacters[1] = "b";
            validCharacters[2] = "c";
            validCharacters[3] = "d";
            validCharacters[4] = "e";
            validCharacters[5] = "f";
            validCharacters[6] = "g";
            validCharacters[7] = "h";
            validCharacters[8] = "i";
            validCharacters[9] = "j";
            validCharacters[10] = "k";
            validCharacters[11] = "l";
            validCharacters[12] = "m";
            validCharacters[13] = "n";
            validCharacters[14] = "o";
            validCharacters[15] = "p";
            validCharacters[16] = "q";
            validCharacters[17] = "r";
            validCharacters[18] = "s";
            validCharacters[19] = "t";
            validCharacters[20] = "u";
            validCharacters[21] = "v";
            validCharacters[22] = "w";
            validCharacters[23] = "x";
            validCharacters[24] = "y";
            validCharacters[25] = "z";
        
            function randomiser() {
                var outputDiv = document.getElementById("output");
    
                var numberOfWords = document.forms[0].numberOfWords.value;
                var wordPattern = document.forms[0].wordPattern.value;
    
                outputDiv.innerHTML = "";
    
                var randomWordsHTML = "";
            
            
                for (var i = 1; i <= numberOfWords; i++) {
                    var randomWord = generateRandomWord(wordPattern);
                    
                    randomWordsHTML += randomWord + "<br />";
                }
    
                outputDiv.innerHTML = randomWordsHTML;
            }
    
            function generateRandomWord(wordPattern) {
                var randomWord = "";
                var wordLength = wordPattern.length;
    
                for (var i = 0; i < wordLength; i++) {
                    if (wordPattern.charAt(i) == "l") {    
                        randomWord += validCharacters[getRandomNumber(25)];
                    } else if (wordPattern.charAt(i) == "n") {
                        randomWord += getRandomNumber(9); 
                    }
                }
                
                return randomWord;
            }
            
    
            function getRandomNumber(max) {
                return Math.floor(Math.random() * (max + 1));
            }
        </script>
    </head>
    <body>
    <form action="#">
    Number of words: <input type="text" name="numberOfWords" />
    <br />
    Word pattern: <input type="text" name="wordPattern" /> (eg. lllnn, will generate words of length 5 made of 3 letters ('l') and 2 numbers ('n'))
    <br />
    <input type="button" name="randomise" value="Generate Random Words" onclick="randomiser();" />
    </form>
    <br />
    <h2>Output</h2>
    <hr />
    <div id="output">
    </div>
    </body>
    </html>
    Save to an html file and run in your browser.
    Then you have to copy/paste words into your text file.
    Last edited by dyewitness; 13-03-2009 at 04:57 PM.

  7. #7
    Gone Erayd's Avatar
    Join Date
    Dec 2004
    Location
    Wellington, NZ
    Posts
    5,761

    Default Re: Mass word generator

    And here's a C one. First argument is the number of strings to generate, second argument is the format code (l=letter, n=number, s=symbol), third argument is an optional filename. If you don't specify a filename, it'll print the strings to the console instead.
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    #include <string.h>
    
    int main(int argc, char **argv) {
    	//vars
    	long i, limit;
    	int i2;
    	const char *letters = "abcdefghijklmnopqrstuvwxyz";
    	const char *numbers = "0123456789";
    	const char *symbols = "~!@#$%^&*()_+=-`{}|[]\\:\";'<>?,./";
    	char *outstr;
    	FILE *fh;
    
    	//count args
    	if(argc < 3) {
    		printf("Not enough arguments!\n");
    		exit(EXIT_FAILURE);
    	}
    
    	//open file handle
    	if(argc > 3) {
    		fh = fopen(argv[3], "w");
    		if(fh == 0) {
    			printf("Unable to open file!\n");
    			exit(EXIT_FAILURE);
    		}
    	}
    
    	//seed prng
    	int seed = (int) time(0);
    	srandom(seed);
    
    	//generate strings
    	limit = strtol(argv[1], 0, 10);
    	printf("Generating %ld random strings...\n", limit);
    	outstr = malloc(sizeof(char) * (strlen(argv[2]) + 1));
    	outstr[strlen(argv[2])] = '\n';
    	for(i = 0; i < limit; i++) {
    		for(i2 = 0; i2 < (int) strlen(argv[2]); i2++) {
    			switch(argv[2][i2]) {
    				case 'l':
    					outstr[i2] = letters[(int) (random() % strlen(letters))];
    					break;
    				case 'n':
    					outstr[i2] = numbers[(int) (random() % strlen(numbers))];
    					break;
    				case 's':
    					outstr[i2] = symbols[(int) (random() % strlen(symbols))];
    					break;
    				default:
    					printf("Invalid format string!\n");
    					exit(EXIT_FAILURE);
    					break;
    			}
    		}
    		//print to console if no filename given, otherwise write to file
    		if(argc < 4) {
    			printf("%s", outstr);
    		}
    		else {
    			fwrite(outstr, strlen(outstr), 1, fh);
    		}
    	}
    
    	//cleanup
    	free(outstr);
    	if(argc > 3) {
    		fclose(fh);
    	}
    
    	//quit
    	exit(EXIT_SUCCESS);
    }
    dyewitness, are you are aware that you can specify an array all in one go? Just use new Array('a', 'b', 'c'); etc.
    Last edited by Erayd; 13-03-2009 at 05:26 PM. Reason: oops - there was a +1 where there shouldn't have been
    If you are interested in reading fanfiction on a mobile device or ebook reader, please visit flagfic.com.

  8. #8
    Senior Member
    Join Date
    May 2008
    Location
    Auckland
    Posts
    186

    Default Re: Mass word generator

    Quote Originally Posted by Erayd View Post
    ...
    dyewitness, are you are aware that you can specify an array all in one go? Just use new Array('a', 'b', 'c'); etc.
    Yes.

  9. #9
    Gone Erayd's Avatar
    Join Date
    Dec 2004
    Location
    Wellington, NZ
    Posts
    5,761

    Default Re: Mass word generator

    Quote Originally Posted by dyewitness View Post
    Yes.
    Then why slow things down and add a ton of extra code by doing one letter per line?

    Edit: You can access strings by index in javascript anyway, so you don't actually need to declare it as an array at all - just specify it as a string 'abcdefghi...', then access individual characters in the same way you would elements of an array.
    Last edited by Erayd; 13-03-2009 at 05:34 PM.
    If you are interested in reading fanfiction on a mobile device or ebook reader, please visit flagfic.com.

  10. #10
    Senior Member
    Join Date
    May 2008
    Location
    Auckland
    Posts
    186

    Default Re: Mass word generator

    Heh, it's a javascript solution so it's going to be slow anyway compared to your C version, but has the benefit of no compilation and browser based

    Having said that:
    - 26 extra lines is hardly going to add much overhead
    - it is a rush job, so coding style isn't high on the priorities
    - I was going to do something else with it, but changed my mind, and the explicit array init just stayed as is
    - it can always be refactored
    - does it really matter?

Similar Threads

  1. looking for web gallery generator
    By hueybot3000 in forum PC World Chat
    Replies: 1
    Last Post: 09-01-2009, 06:11 PM
  2. Form Generator Program
    By Ericee in forum PressF1
    Replies: 2
    Last Post: 07-03-2007, 08:04 PM
  3. Thumnail Generator for WEb
    By gum digger in forum PressF1
    Replies: 0
    Last Post: 12-07-2005, 11:38 PM
  4. jargon generator
    By in forum PressF1
    Replies: 1
    Last Post: 12-02-2001, 01:45 PM
  5. Jargon Generator
    By in forum PressF1
    Replies: 0
    Last Post: 22-08-1999, 11:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •