This name generator constructs and uses Markov chains. Given a list of sample names, it analyzes each name to construct frequency tables for name length and letter pairs. It then uses these tables to construct a new name in the style of the sample set.
defines an array list of sample names as a named element of the
name_set object (which is declared in
Then, include both the
name_generator.js file and
your data file in your HTML page. A clever person might note that
you could easily create and include more than one data file here.
<script src="name_generator.js"></script> <script src="egyptian_set.js"></script>
generate_name() function accepts a single
argument, the name of your name set, and returns a text string.
You can simply write this text string to the HTML page...
You may also be interested in the
function, which accepts the name of a name set and a number,
and returns an array of generated names.