Random name generator in Python

In this short tutorial I will show you how to make a random name generator in Python.

If you came here looking for some cool random names visit the online name generators.

The name generator script

Open IDLE which is the Python supplied IDE or editor (Go to the bottom of the post to see, how you get started with Python).

Open a new window from the file menu and write the following name generator script into this window.

def name_generator():
  import random
  color = ["Red","Blue","Black","White"]
  tool = ["Hammer","Drill","Cutter","Knife"]
  randomNumber1 = random.randrange(0,len(color))
  randomNumber2 = random.randrange(0,len(tool))
  name = color[randomNumber1] + " " + tool[randomNumber2]
  print(name)

name_generator()

(Be aware that copy-paste from the blog may give syntax errors!
 A correct indent is an important element Python syntax!)

Save it as name-generator.py.  Now you can run the python program by pressing F5.

Name generator walk through

Lets walk through the python script, line by line.

  1. In the first line we define our name generator function.
  2. Then we import the random module, so we can call the random function later on.
  3. In line define 2 arrays (color and tool) and asign values to them
  4. Then we make 2 random numbers based on the length of our arrays. The randrage() function returns an integer in the range defined by the parameters. As parameters we use 0 and the len() function to count the numbers of words in the arrays.
  5. In line 7 and 8 we make the final name and print it on the screen.
  6. Finally we call the name generator function, we have just written.

That’s all it takes to make a simple Python random name generator. When you this basic functionality it’s easy to experiment and develop the random name generator to suit your needs and wishes.

Name generator inspiration

For inspiration visit the name generators where you can find a lot of name generators in several genres. From random names over fantasy and nicknames to band and business names.

Python Beginner guides and tutorials

Python is a free scripting language running on all platforms from Linux to Windows. Python is a relative easy programming language and a name generator is a simple application so it’s a good place to start if you wanna learn some programming.

If you haven’t Python installed at your computer you can download it at Python.org. This name generator script is based on python 3.12, which is the newest stable version at the moment.

At python.org you can find an excellent Python tutorial. And you can find much more about how to use the Random function in Python.

Or visit this beginner guide to Python which contains lots of links and resources.

Posted in Name generator stuff | Tagged , , , | 4 Comments

Name randomizer

When people think of a name randomizer, they usually mean 1 out of 3.

  1. A random name generator. A  program that makes random names from scratch
  2. A  small app that choose random names from a list. Could be a “choose student to answer a question” radomizer
  3. A application that take the names from a known group of people and randomize the output from a known input

In this post I’ll show you how you make all of these 3 different kinds of name randomizers. It’s quite easy, and you can found both tutorials and  download name randomizer scripts here at my blog. Just keep reading.

1. The random name generator

The first example of a name randomizer is the classic random name generator. The random name generator takes a bunch of names, mix them all together and randomize the output. At my name generators web site you can find a lot of different classic name generators in a whole lot of categories.

If you wanna make your own a name generator take a look at this description of  how you make a name generator. Or download my complete name generator script. It’s thoroughly commented and described and therefor very easy to adjust to your own likings and ideas.

2. Choose a random student

If you want a name randomizer that pick a student from a list, you need another sort of random application. In this JavaScript tutorial: choose a random person, I guide you through the process of how you make your own name randomizer, you can use for choosing students for questions.

This randomizer tutorial was made for a teacher, who needed an application to choose a random student from a list. In the blog post you can also find a choose student script ready for download. You just need to add the names of your students.

3. Randomize known or famous names

This is basically the same as the the classic name generator. The only different is the content you choose to fill in the the arrays or name list.

You can make a guitarist name generator by using the names from world famous guitarist, or what about a dictator name generator, a politician name generator. Or could make a script that randomize the names of all the guest to your next big party. That could be fun. Sky is the limit. 😉

It’s very easy to do. Just grab my name generator script, read the how to (check the first item in this list)  and add you own names and ideas.

Your name randomizer

As always. If you make a cool randomizer, application or other online gadget throw a comment and tell me and the world about it. 🙂

Posted in Name generator stuff | Tagged , , | 2 Comments

Choose random person

I made a little script that choose a random person from a list.

The background is that I got this mail from a reader, who need to  choose a random student from his class to answer questions.

Tom wrote:
I am a teacher and we have to randomly choose students to call and answer questions.  Right now we use popsicle sticks with name on stick.  I would like to be able to set up 4 classes,  type in the names of the students from the class and have the app pick a name out of that class randomly.

Beside choosing persons randomly such a random app  also can be used to random pick all kinds of objects or items from a list. Script is programmed in JavaScript.

Choose random person script

Here’s a very simple but useful script, which choose a random student  from a list of names.

function choose_student(){
    // Add your own student names to the class list
    var class_list =  ["Marge","Maggie","Lisa","Bart","Homer","Apu","Burns"];

    // Random numbers are made
    var randomNumber = parseInt(Math.random() * class_list.length);

    // Student are chosen from the class array with the random number
    var name = class_list[randomNumber];

    // Name is shown in alert box
    alert(name);
}
  1. First you make an array (a list ) with the names of the persons you want to choose from
  2. The Math.random() makes random numbers between 0 and 1. By multiplying it with the numbers of students of the list (found with the length function) and flooring it all with the parseInt() function, we will get a number between 0 and numbers of students in the class minus 1.
  3. The person in the position of the random number is extracted from the list and saved in a variable. (the item in the first position in an array is called with the index number 0 like this: myArray[0])
  4. Finally the chosen students name is shown in JavaScript alert box.

And finally you just need to call the “choose random student”-function from your HTML.

<input type="button" value="Chose Random Student" onclick="choose_student()" />

Download example script

You can download an example choose random person script here. In the script you can find both the above pick random person script and the pick random student script I made for Tom. All is integrated in a complete HTML file ready to launch in your favorite browser.

The example script is integrated roughly into my name generator script, but it should give a good overview over how to accomplish the task of picking random persons from simple lists, and how to integrate a simple random application into a HTML page.

Is it the above method truly random?

In short no, but semi randomness is sufficient and adequate for the purpose of selecting random persons for none scientific reasons.

Read more about true random numbers and names.

clipped from web.archive.org
http://web.archive.org/web/20011027002011/http://dilbert.com/comics/dilbert/archive/images/dilbert2001182781025.gif
blog it
Posted in Other generators | Tagged , , , | 3 Comments

Band name widget

Band name widget at Australian band site entertainya

I was contacted by Aladdin from the  Australian band site entertainya. Aladdin wanted a band name  widget to spice up entertainya.com.au.

Alladin wrote:
My Name is Aladdin, I run and own an Australian online music and entertainment called entertainya. I have been on the hunt for something fresh and exciting to add to my site as i have 1000’s of musicians browsing everyday.
I came across your project and would love for you to consider allowing me to integrate your band name generator onto my site.

I thought the idea sounded exiting and started to develop a band name widget. The band name widget gave the idea to make a free  name generator widget.

Band name generator

The band name generator  widget is a  full copy of the band name generator. Same amount of band name combinations and with a 100%  functionality.

You can see the band widget and how seamless  it integrates with the site.  Entertainya.com.au is based on a  joomla cms.  The band generator code is run locally on the client, so it will work with all blogs, cms as well as ordinary html pages.

Behind the band widget

The band name widget is programmed in JavaScript, HTML and CSS, and Alladin  just needed to add a single line of JavaScript to include on his website.

The widget is compressed to minimize download time, and of course follows the w3.0rg standards for proper HTML and validates as XHTML 1.1.

Do you want a cool name widget too?

Do you want a similar or other specialized cool name widget on your site, blog or  favorite forum? Check out this free name generator widget.

Are you looking for a different kind of cool name widget? Please contact me and let’s see if we can work out something.

Other ways to get a name generator

How to make a name generator

Name generator script

Posted in Name generator stuff | Tagged , , | 1 Comment

Name generator widget

I continue to give away stuff.  This time it’s a name generator widget.

The name generator widget integrates seamlessly with the web site. The widget contains all the necessary code to run very easily on a web page. Just add a single line of code to your page.

The name generator widget makes code names, that can be used in various ways.  Use the  widget to make code names for bands, projects, blog names etc.

See how the widget works at my sidebar. —–>

How to install the widget

Just insert this line of simple  code, where you want the  name generator to run, and you got a fully functional name generator on your site.

<script type=”text/javascript” src=”https://name-generators.com/widgets/name-generator-widget-beta.js”></script>

The widget takes care of the rest. From name generation to styling.

How to customize the name widget.

Use firebug or other developer tool to see the unique id’s and classes on  all elements.  Just add these to your style sheet with the styles you want. In this way it’s easy to add background images or cool buttons to the widget.

Name widget specs

The widget is programmed in JavaScript. It is minified to minimize the load time for your users.

The name widget  works crossbrowser. It is tested in Firefox, Internet Explorer 7+8, Opera and Chrome.

It follows the XHTML standarad set by the w3.org and validate as XHTML 1.1.

Do you want another name widget?

Do you want a business, superhero or maybe a fantasy name widget on your site, blog or  favorite forum?

Please contact me and let’s see if we can work out something. I’m always interested in some serious text link cooperation. 😉

For another working example check this band name generator widget.

Other free name generator stuff

Also remember to check out the:

How to make a name generator

Name generator script

Posted in Name generator stuff | Tagged , | 9 Comments

Talk like a pirate day 2010

We are rapidly closing in on talk like a pirate day in 2010. In 2010 is will be 17’th celebration of the talk like pirate day.

As usually the annual pirate day is held on September the19’th . In 2010 it on a Sunday.  So again this year we got to celebrate the talk like a pirate day away from the office. But hey. When you got a cool family it’s OK. My Sons are 12 and 14 so it’s about time, that the get a closer knowledge of the more adult and humoristic approach to  pirate talk, pirate life and pirate names.

Talk like a pirate resources

Talk like a pirate day website. The official talk like a pirate day homepage. Talk like a pirate day was started by John Baur and Mark Summers  in 1995. In 7 years they were pretty much the only nerds in the world celebrating the annual talk like a pirate day. Today we are many more.

Pirate name generator. Can’t go through the pirate day without a cool pirate name. The pirate name generator uses old pirate expressions and pirate names to generate genuine pirate names. I just gave the pirate name generator a major brush up to make it ready for the talk like a pirate 2011.

Pirate dictionary. If you wanna talk like a real one, you can’t avoid the pirate dictionary.

Pirate day on facebook. Well of course pirate day also got a fan side on facebook. Over 7000 members have joined the group today and the group is rapidly growing.

Now you should be ready to have a cool and groovy talk like a pirate day 2010. Have a fantastic day. 🙂

Posted in Name generator stuff | Tagged , , | 1 Comment

Name generator script

I have made a  complete name generator script to download and use as your own. The script contains a full functional HTML page with all necessary JavaScript code, HTML and CSS, and can be run in any browser.

The name generator script is a complete do-it-yourself name generator! Ready to run with or without changes. The script is a simplified version one of the one I use at all my name generators.

The script is thoroughly explained and commented in the download file. So it is very easy  to work with for everybody, even for beginners to web programming. If you like further explanation on how the script works visit my How to make a name generator tutorial, where i you through a only slightly more simple generator script.

To get up and running just download the script, change the text and change the word arrays to your likings.  And you got yourself your own personal name generator.

How to use the name generator script

Getting started

Download the name-generator-script.zip.

Or just visit the name generator script demo, right click the page. Select view source. Copy the source to a text-editor.
Save is at generator.html.

How to run it

It’s easy. Just open the html file with your favorite browser.

How to edit it

To edit this page open it with a text editor with syntax highlighting. I’ll strongly recommend notepadd++ a free, fast and flexible text editor, I also use myself.

Name Generator FAQ

No one yet. Guess the code must be  self-explanatory. 😉  Well seriously… if you need help just ask your questions below. I’ll try my best to help you.

EDIT: Well now the comments works as a FAQ.  Please check them to see if you question already has been asked.

How to get visitors on your new name generator

If you make a cool name generator, I might wanna make a review of it. Just write a comment and I’ll look into it.

How to host your new name generator

There’s several ways to host your new name generator.

If you want your own domain name there’s a lot of companies to choose from. If you stick to some of the bigger companies the hosting is often very reliable.

The price level is often low and sometimes you can get a free domain name with the hosting plan.

But you can also find free hosting, if you don’t want your own domain.  Just make sure the service you choose supports the running of JavaScript.

Posted in Name generator stuff | Tagged , , | 60 Comments

How to make a name generator

In this tutorial I’ll show how to make a simple name generator. A sort of  “build your own name generator” to experiment with. You just need to add your own word lists and you’re up and running.  But you can expand and modify the  name generator code to your own likings and abilities.

The name generator tutorial is very simple and are aimed at absolute beginners in web programming.

But enough talk, here is some name generator code that makes superhero names:

function generator(){
  // Add your own words to the wordlist. Be carefull to obey the showed syntax
  var adjectives = ["Cool","Masked","Bloody","Lame"]
  var animals = ["Hamster","Moose","Lama","Duck"]

  // Random numbers are made
  var randomNumber1 = parseInt(Math.random() * adjectives.length);
  var randomNumber2 = parseInt(Math.random() * animals.length);
  var name = adjectives[randomNumber1] + " " + animals[randomNumber2];

  alert(name); //Delete this when the below works            

  //If there's already a name it is removed  
  if(document.getElementById("result")){
    document.getElementById("placeholder").removeChild(document.getElementById("result"));
  }
  // A div element is created to show the generated name.
  //The Name is added as a textnode. Textnode is added to the placeholder.
  var element = document.createElement("div");
  element.setAttribute("id", "result");
  element.appendChild(document.createTextNode(name));
  document.getElementById("placeholder").appendChild(element);
}

The script is a simplified version of the one I use to make superhero names with my superhero generator.

The name generator piece by piece

The arrays

The most important part of  the name generator is the word lists. The more words in the list the more variety in the output. So the first part to do is to create a couple of arrays holding all our cool words:

var adjectives = ["cool","masked","bloody","lame"];
var animals = ["hamster","moose","lama","duck"]

To retrieve data  from the list we call the name of array with the count of the word as a parameter in a square bracket.  Be aware that counting in programming almost always starts at zero and not at 1.

So adjectives[0] is cool and  animals[1] gives moose

Randomness

We of course want random names, so we need to replace the hard coded numbers with random numbers. In our case numbers between 0 and 3 because we have 4 words in our lists. Instead of counting the words ourself, we let the JavaScript .length function do the counting. Then we multiply it with a random floating-point number between 0 and 0.9999999999999. Finally we use the parseInt() funktion to make the floating-point number into an integer.

All sounds a bit complicated but code wise  it’s  quite easy.

randomNumber1 = parseInt(Math.random() * adjectives.length);
randomNumber2 = parseInt(Math.random() * animals.length);

The output

The most simple way to output the name is using the alert() function. I use it only to check the generated name cause,  the alert box is  very annoying. So just delete the line, when the code below is up an running.

We will use 7 extra lines to integrate the result into the web page in a more natural way.

But before we begin you need to make an empty div tag in your HTML:

<div id=”placeholder”></div>

And here are the 7 lines that write the result in the page..

if(document.getElementById("result")){
  document.getElementById("placeholder").removeChild(document.getElementById("result"));
}

element = document.createElement("div");
element.setAttribute("id", "result");
element.appendChild(document.createTextNode(name));
document.getElementById("placeholder").appendChild(element);

In short it works like this:

  1. If there’s already a result it is removed
  2. Then a new div element to hold the result  is created
  3. The name is added as a text node
  4. Finally the element is appended to a placeholder in the HTML.

When this part works, you can delete the alert(name) from the script.

Putting it all together

The generator function can either be included in the head of the HTML document or you can place it in a external JavaScript file.

Now you can call the function from your HTML page.  I always do it 2 places. First in the body tag with an onload event. The generator function then also runs when the page is loaded.

<body onload=”generator()”>

And then I also call the JavaScript function on a button:

<input type=”button” onclick=”generator()” />

Download the name generator script

Download name generator script here and read the description of how to make the name generator script work.

Extra funcionality

The random functions in this guide is very simple. At some time you’ll probably want to make more complex and interesting names. Here you can see how to make more complex random names.

On all of my name generators I also have a save list, which saves all the generated names to a list. Read here how to add a save list to the name generator.

Also remember to visit my name generators to see  how I make superhero names with the superhero generator.

Posted in Name generator stuff | Tagged , , | 65 Comments

Easy online spell checking

One of the most important things when it comes to writing and publishing stuff on the Internet is spell checking. Spell checking can with the right tools be done in a few minutes and it it will increase the credibility of your work tremendously. No need to say that spell checking is even more important for non native English speakers like myself.

In this post I have collected the best tools for precise, fast and easy spell checking.

Online spell checking

Orangoo spell check is my favorite online spell checker. I just copy all my text from my code editor, paste it in the Orangoo and start the spell checker. When done, I copy the edited text and paste it back into my editor. Very easy and intuitive to use, and a great example of a simple online web application, that does the job in an easy way. No complicated configurations and choices to make. Just pure functionality.

Orangoo online spell checkers handles close to 30 different languages.

Alternatively Orangoo also offers a complete spell checking scan of your website. Type in the URL of your site and your e-mail, and you’ll receive a complete report of the entire website for spelling mistakes and typos.

Browser spell check

Spell checking in your browser is a lot easier that the online counterpart. It makes it a lot simpler to spell check blog posts, online articles, web-based emails and  posts on forum, facebook, myspace or whatever social networks and online communities you’re using.

Firefox has been offering build-in and inline spell checking since Firefox 2.0. It’s easy to change language of the spell checker and to download new language packages. All is done with a right click in your browser on the text area you wanna check for mistakes and typos. The Firefox spell checker performs a live spell checking. Just like we know it from our word processing software.

For Internet Explorer I highly recommend the ieSpell. ieSpell is a free Internet Explorer browser plug-in, that spell checks text input boxes on webpages. Opposed to Firefox ieSpell does not perform live spell checking, but need to be activated from the browser menu or a tool bar.  I have used this easy tool in many years and only have nice things to say about the plug-in.

Alternatives

When in doubt I sometimes use the Google search for a simple test. Their  “did you mean”-service is brilliant if you wanna spell check a single word or a simple phrase.

I also like to mention WordWeb. WordWeb is a English dictionary, thesaurus, and word finder software for Windows. The application is free for private use and is a great tool when you’re working with the English Language.

Feel free to add a comment if  I missed out on other easy spell checkers or methods.

Posted in Webmaster stuff | Tagged , , , | 1 Comment

Blog name generator

A friend of mine suggested that I made a blog name generator. Why? I already have a great blog name generator.  😉

Code Name – Blog Name Generator?

No reason to start all over. The  Code and Blog Name Generator makes cool  ideas for blog names.  By design it of course is originally a code name creator, but  the results is useful in a wide variety of areas. And many of the generated code names would also work great as blog names. What would you say to blog names like:

  • Rough Heart
  • Scarlet Moving Pens
  • Autumn Confidential
  • Subtle Knife

I think they could be pretty cool blog names. So from today instead of  reinventing the wheel, I simply claim the code generator to also be a Blog Name Generator.

EDIT: I just added a domain availability check function, so you right away can check if the suggested blog name is available as a domain name. Several top level domains are checked.

Making names

The names are made by 2 and 3 word combinations from word list specially chosen for making code names. Words with lots of  meaning a strong ability of creating  images. The results is powerful, inspiring and creative code and cool blog names.

An algorithmic program gives variation and up to 5 million different code or blog names.

What is in a good blog name

Well it really depends on the he subject of the blog and the personalty of the blogger. But a good blog name could be

  • describing for the content of articles and subjects
  • content important keywords
  • memorable
  • catchy and cool

A blog name generator can’t do much for you if you’re looking for specific and descriptive title like the title of my blog. But if you’re looking for catchy, cool, funny blog  names, a name generator can help you in the process.

Idea generator

Don’t expect too much. A name generator is basically an idea generator. It does not necessarily make the perfect names. A simple artificial intelligence of a rather simple script don’t get the subtle meanings in certain word combinations. And it’s often  the subtle nuances and meanings that separates the good blog name from the bad one.

The strength of a generator is that it can come up with endless combinations, cool ideas and a lot of suggestions.

You just have to take the good ideas and form them into you personal blog name.

Go to the Code and Blog Name Generator.

Make your own blog name generator

If you are not happy to use the code name generator as a solution, it has never been easier to make you own blog name generator. You just have to download the full functional name generator script, and add you own word lists.

In a  few minutes you can have a simple blog name generator up and running. And if you put a little more work into it, you can very easily make a full blown blog name generator.

Posted in Name generator stuff | Tagged , , , | 25 Comments