random-person

return random names and cities (weighted by population in U.S. census data).

Usage no npm install needed!

<script type="module">
  import randomPerson from 'https://cdn.skypack.dev/random-person';
</script>

README

random-name

return random names and cities (weighted by population in U.S. census data).

  var random = require('random-name')
  console.log(random());

  //provides first, middle, last, female, and male names.

  console.log(random.first())
  console.log(random.middle())
  console.log(random.last())
  console.log(random.female())
  console.log(random.male())

  //also, random place name!
  console.log(random.place())

  //or a person object with gender matching first and middle, and a state
  var person = random.person();
  console.log(person.full_name, "from", person.city + ", " + person.state);

also optionally builds names using markov chains

  var random = require('random-name')
  console.log(random(true));
  console.log(random.first(true))
  console.log(random.last(true))
  var person = random.person(true);

Taken from the U.S. census geneology website and the U.S. census population estimate

To make this more browser friendly, the .json files are limited to 500 entries

To regenerate the data using more entries edit MAX_COUNT in original_census_data/build_json.js and re-run the script: node original_census_data/build_json.js

License

MIT