Skip to content

Instantly share code, notes, and snippets.

@tyteen4a03
Created December 5, 2023 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tyteen4a03/92d7a6f49e19497a254992cebd0acc33 to your computer and use it in GitHub Desktop.
Save tyteen4a03/92d7a6f49e19497a254992cebd0acc33 to your computer and use it in GitHub Desktop.
Generate Microsoft-friendly random passwords
const VOWELS = 'aeiou';
const CONSONANTS = 'bcdfghjklmnpqrstvwxyz';
const generateInitialPassword = () => {
const vowel = VOWELS[Math.floor(Math.random() * VOWELS.length)]
const consonant = CONSONANTS[Math.floor(Math.random() * CONSONANTS.length)]
const randomNumber = Math.floor(Math.random() * (999999 - 100000 + 1)) + 100000;
return `${consonant.toLocaleUpperCase()}${vowel}${consonant}${vowel}${randomNumber}`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment