How to generate password

Here's something which is nice and might be easy to remember:

StringJoin @@ RandomSample[#, Length@#] &@
 Flatten@{IntegerString@RandomInteger[{10, 999}],
   Capitalize /@ RandomWord[3],
   RandomSample[Characters@"!@_%$^=+*.", 2]
   }

Select examples:

"Tearless+PostdoctoralDragon=635" (*DEFINTIELY MY FAVORITE!!*)
"Workpiece.Monopolize908Moderate="
"Venereal854RebelliouslyProportionality%."

EDIT

To increase the entropy, you may want to make spelling mistakes. Here's a great way to produce pronounceable non-words:

spoilWord[word_String] := 
 Transliterate@
  Transliterate[word, 
  RandomChoice@{"Hebrew", "Arabic", "Japanese", "Korean","Greek"}
 ]

Example:

spoilWord@RandomWord[]
(*"matelialismeu"*)

A shorter formulation equivalent to your own code is:

FromCharacterCode @ RandomInteger[{33, 126}, 10]
"+(pCT4W#;T"

However quite a few places only accept alphanumeric passwords, and not all keyboards have the same easily accessible character sets. If we assume that your given example is sufficiently secure you need 94^10 ~= 5*10^19 unique passwords. This is easily accomplished by adding a single alphanumeric character as 62^11 ~= 5*10^19. Therefore I propose:

rnd =
  FromCharacterCode @ 
    RandomChoice[Join @@ Range[{48, 97, 65}, {57, 122, 90}], #] &;

rnd[11]
"liLC2RoA3cR"

Or five passwords at once:

rnd[{5, 11}]
{"suPwm0c7FxS", "CV3khXaowWS", "Lac9z1IVCwc", "gptfkp2GMwH", "HDhRuFPLxte"}

Tags:

Random