Yet another Random password generator

By Matt5150 on May 13, 2013

A custom length password generator

Example usages:

//echo -a Random password 10 characters long: $rpass(10)


alias rpass {
  var %:a = $1, %:rpass
  while (%:a) {
    if ($regex($r(1,3),1)) { var %:rpass = %:rpass $+ $r(0,9) }
    else { var %:rpass = %:rpass $+ $iif($regex($r(1,2),1),$r(a,z),$r(A,Z)) }
    dec %:a
  return %:rpass


Sign in to comment.
sagargulati   -  Jun 01, 2013
Sorasyn   -  May 13, 2013

Seems much more compact than the one I rigged up a few days ago for a snippet I used to generate MD5 Hashes from random strings, or passwords if you will.

Matt5150  -  May 13, 2013

Yeah! There are a lot of random string snippet XD
I was bored, so I decided to make my own "random pass generator"
As you can see, there is 1/3 chance to return a number otherwise a letter (50% uppercase 50% lowercase).

Sorasyn  -  May 13, 2013

I don't think arrays are built in to mIRC which is a shame. I believe I used a pre-existing character set builder class to specify which set to build from. So it can be modified to use only upper, lower, both, numerical, alpha numerical, or all characters (to a certain degree). Chosen at random, of course.

Gummo  -  May 16, 2013

I don't understand the use of $regex() in


when you can use


The same goes for the if statement further up. If you want it to be more readable, use $r(0,1) == 1 for example.

Matt5150  -  May 16, 2013

Yeah I know that, but I used regex to make it "a little" different from the others :P
there are a lot of ways, for example letters $r(a,b)
or things a little more elaborate, like this ($right($calc($r(1,10) / 2),2) = .5)

Sorasyn  -  May 16, 2013

If you're wanting to stand out, efficiency is the place to do it. Regular expressions do a lot of string parsing, which ultimately means you end up doing much more work than necessary. Size is nothing, speed is everything.

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.