names.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // data/names.js — English name lists for random generation
  2. const FIRST_NAMES = [
  3. 'James', 'John', 'Robert', 'Michael', 'William', 'David', 'Richard', 'Joseph', 'Thomas', 'Christopher',
  4. 'Mary', 'Patricia', 'Jennifer', 'Linda', 'Barbara', 'Elizabeth', 'Susan', 'Jessica', 'Sarah', 'Karen',
  5. 'Daniel', 'Matthew', 'Anthony', 'Mark', 'Donald', 'Steven', 'Andrew', 'Paul', 'Joshua', 'Kenneth',
  6. 'Emma', 'Olivia', 'Ava', 'Isabella', 'Sophia', 'Mia', 'Charlotte', 'Amelia', 'Harper', 'Evelyn',
  7. ];
  8. const LAST_NAMES = [
  9. 'Smith', 'Johnson', 'Williams', 'Brown', 'Jones', 'Garcia', 'Miller', 'Davis', 'Rodriguez', 'Martinez',
  10. 'Hernandez', 'Lopez', 'Gonzalez', 'Wilson', 'Anderson', 'Thomas', 'Taylor', 'Moore', 'Jackson', 'Martin',
  11. 'Lee', 'Perez', 'Thompson', 'White', 'Harris', 'Sanchez', 'Clark', 'Ramirez', 'Lewis', 'Robinson',
  12. ];
  13. /**
  14. * Generate a random full name.
  15. * @returns {{ firstName: string, lastName: string }}
  16. */
  17. function generateRandomName() {
  18. const firstName = FIRST_NAMES[Math.floor(Math.random() * FIRST_NAMES.length)];
  19. const lastName = LAST_NAMES[Math.floor(Math.random() * LAST_NAMES.length)];
  20. return { firstName, lastName };
  21. }
  22. /**
  23. * Generate a random birthday (age 19-25).
  24. * @returns {{ year: number, month: number, day: number }}
  25. */
  26. function generateRandomBirthday() {
  27. const currentYear = new Date().getFullYear();
  28. const age = 19 + Math.floor(Math.random() * 7); // 19 to 25
  29. const year = currentYear - age;
  30. const month = 1 + Math.floor(Math.random() * 12); // 1 to 12
  31. const maxDay = new Date(year, month, 0).getDate(); // days in that month
  32. const day = 1 + Math.floor(Math.random() * maxDay);
  33. return { year, month, day };
  34. }