Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Star Wars Name Generator Website Code

Hi guys,

need a starwars name generator HTML Code for a website project for my college. I have no experience with coding so i really need some help if u can just PM me or post a reply. Thanks.
(Jan 19, 2019 09:33 AM)deityjake Wrote:  Hi guys,

need a starwars name generator HTML Code for a website project for my college. I have no experience with coding so i really need some help if u can just PM me or post a reply. Thanks.

I will give you an example & you can just fill in the values to make it better :)

PHP
PHP Code

<?php 
$firstnames 
= array("Anakin", "Padme", "Cassian", "Raymus", "Darth", "Sio", "Jar Jar", "Commander", "Count", "Boba");
$lastnames = array("Skywalker", "Amidala", "Andor", "Antilles", "Vader", "Bibble", "Binks", "Bly", "Dooku", "Fett");
$numfirst = count($firstnames);
$numlast = count($lastnames);
$randfirst = rand(0, $numfirst);
$randlast = rand(0, $numlast);
echo 
$randomname = "{$firstnames[$randfirst]} {$lastnames[$randlast]}"; 

JS
Code
var firstnames = ["Anakin", "Padme", "Cassian", "Raymus", "Darth", "Sio", "Jar Jar", "Commander", "Count", "Boba"],
lastnames = ["Skywalker", "Amidala", "Andor", "Antilles", "Vader", "Bibble", "Binks", "Bly", "Dooku", "Fett"],
numfirst = firstnames.length,
numlast = lastnames.length,
randfirst = Math.floor(Math.random() * (numfirst.length)),
randlast = Math.floor(Math.random() * (numlast.length)),
randomname = firstnames[randfirst] + " " + lastnames[randlast]

Both of these examples choose a random first name, a random last name, and combine them.
If you want REAL Star Wars names (example: Jar Jar Binks, never Jar Jar Fett) then you would put the first & last names in one array & just use the random function for the single array :)
with a better seed..

Code
<?php
//sunjester
$names = ["name", "name2", "name3", "name4", "name5", "name6"];
$seed = explode(' ', microtime());
srand($seed[0]+$seed[1]*1000000);

for($i=0;$i<4;$i++)
{
        echo $names[rand(0,count($names)-1)]."<br/>";
}
?>
http://sunjester.rf.gd - proxies, logins, scanner results
JS:

Code
const f_names = ['jake', '""deity""'];
const s_names = ['lol', 'rly'];

let name = `${
   s_names[~~(s_names.length * Math.random())]
},  ${
   f_names[~~(f_names.length * Math.random())]
}`;

oops didn't see phlex posted a JS one as well.
Thanks so much man appreciate it bigtime


Possibly Related Threads...
Thread / Author Replies Views Last Post
by WordlistJan 9, 2016 01:16 PM 7 233 Jan 9, 2016 01:16 PM
Last Post: Wordlist
by кuтснїеJun 3, 2011 05:03 PM 15 329 Jun 3, 2011 05:03 PM
Last Post: кuтснїе