Paul Chris Jones's coding blog
PHP
JS

Pornstar name generator

25th June 2019

I thought it would be fun to make a pornstar name generator. You click on a button and it generates a new pornstar name.

I'll be using JavaScript and jQuery for this project.

Step 1: Get a list of real pornstar names

The first step is to find a list of real pornstar names that the generator can use as inspiration.

https://en.m.wikipedia.org/wiki/List_of_pornographic_performers_by_decade has a list. I copy pasted the source to Sublime Text then used regex to replace <li><a href="/wiki/.*" title=".*">(.*)</a></li> with $1. This removed much of the html. I then manually went through and put the male and female names into two seperate files. I then found more pornstar names from https://www.thepornlist.net/pornstars/, and I used regex to extract these as well.

After doing that, I had a list of 249 male porn star names and 554 female porn star names. This is enough to work with I reckon.

Step 2: Remove duplicates

I removed duplicates from the list by running the following bash command:

$ sort -u list_male_pornstars.txt > output1.txt
$ sort -u list_female_pornstars.txt > output2.txt

This also had the bonus affect of sorting the names in alphabetical order.

Step 3: Put the pornstar names into arrays

I put both lists of pornstar names into arrays.

female_pornstar_names = [
"Andrea True",
"Annette Haven",
"Annie Sprinkle",
"Bodil Joensen",
"Brigitte Lahaie",
"C. J. Laing",
[...]
"Shyla Stylez",
"Sindee Jennings",
"Tori Black",
"Tory Lane"
];

male_pornstar_names = [
"Alban Ceray",
"Billy Dee",
"Bobby Astyr",
"Bobby Hollander",
"Carter Stevens",
"Don Fernando",
[...]
"Jonathan De Falco",
"Jordi El Niño Polla",
"Xander Corvus"
];

Step 4: Retrieve a random name

Now we need the generator to give us a random name. Here's code that gives a random name from the list of female pornstars:

$("#output").html(Get_random_pornstar_from_list(female_pornstar_names));

function Get_random_pornstar_from_list(female_pornstar_names){
	var length_of_list = female_pornstar_names.length;
	var random_number = Math.floor(Math.random()*length_of_list);
	return female_pornstar_names[random_number];
}

Step 5: Retrieve a random first name and a random surname and then combine them into one

My idea to generate a random porn star name is to take two existing names and combine them into one. Specifically, the generator takes the first name of one pornstar and the surname of another, and then combines them to make a fresh name. Here's the code that does this:

var name1 = Get_random_pornstar_from_list(female_pornstar_names);
var name2 = Get_random_pornstar_from_list(female_pornstar_names);
var new_name = Combine_pornstar_names(name1, name2);
$("#output").html(combined_name);

function Combine_pornstar_names(name1, name2){
	var name1 = name1.replace(/ .*/,'')
	var name2 = name2.replace(/.* /,'')
	combined_name = name1 + " " + name2;
	return combined_name;
}

Step 6: Check if the name already exists

We don't want names that already exist. We want new ones. Therefore, the generator needs to reject names that are already real pornstar names. This can be done by adding a while loop: while the pornstar name is real, keep generating new names.

function Generate_new_pornstar_name(){
	name = "";
	while(Pornstar_name_is_real(name) || name === ""){
		var name1 = Get_random_pornstar_from_list(list_of_pornstar_names);
		var name2 = Get_random_pornstar_from_list(list_of_pornstar_names);
		var name = Combine_pornstar_names(name1, name2);
	}
	return name;
}
function Pornstar_name_is_real(name){
	console.log("Checking if " + name + " is a real porn star...");
	position_in_array = $.inArray(name, list_of_pornstar_names);
	if(position_in_array===-1){
		console.log(name + " is not a real pornstar.");
		return false;
	}
	else{
		console.log(name + " is a real pornstar.");
		return true;
	}
}

Step 7: Improve the look of the webpage

Finally, I should improve the generator's appearance. This can be done with a fuckload of css.

I animated the pornstar name with animate.css. Whenever you click on the generate button, it adds the animation class "fadeIn" to the pornstar name. I also used font-awesome to animate the generate button so that it spins when you click it.

I had to add more JavaScript to get the animations to work:

$("#generate_new_pornstar_name").click(
	function(e){
		e.preventDefault();
		name = Generate_new_pornstar_name();
		Display_name(name);
		$("#icon").addClass("spin-animation");
		$("#name").addClass("fadeIn");
        setTimeout(function(){
			$("#icon").removeClass("spin-animation");
			$("#name").removeClass("fadeIn");
        }, 500);    
	}
)

Step 8: Upload the project on a website

I wanted the pornstar name generator to have its own website, so I bought the domain generate-me.com for this purpose. No-one else had taken it yet so it only cost me €8.

I then assigned the domain with my hosting provider, Bluehost.

Then I uploaded all the files from my computer to the server:

scp -r . username@website.com:public_html/generateme/

Finished project

You can see the finished project by going to generate-me.com or by simply scrolling down.

Nerd name generator

I also made a nerd name generator, just for shits and giggles:

Pirate name generator

And a pirate name generator:

Leave a comment