Random String

By EliteT0kr on Oct 06, 2004

Returns a random string. Usage: $rs(number of random variables, variable 1, variable 2)

for example:

//echo -a $rs(333,A,Z)

would return PXYGGIXKMLQHRCDXIGXKWNGLINPHFHRXNOVXECTZBGBAJKMAXLAPADUDUDLNAUBIDYOWJKLOPUXCBOIEFRAHTQEJHYQGTAABEIPCXKUIQBSHBXULVONGKUMPYXGRRLGARNJDHPZDUMQGNZOTAZQRZSWDKBXRVFCBLCLCNIXAJFQMCDBETMKYPSHPKZXRWFYAZDCMSNQWRAOEJLSAYFRQRPGVNOWSHXISYLDKUDNGNUOPLNUAVORUILSOHSHHPQFDPGRICDNCMXXZRVFHDGFLGJSOUWWRWSYYBLXUAUBRGDYZIHPYOPPOTWDVAVGWXQLOJVWOHKIMJBWGS

alias rs {
  if ($0 == 3) {
    var %RCount 1 | var %RSet $1
    while (%RCount <= %RSet) {
      var %RString %RString $+ $rand($2,$3)
      inc %RCount 1
    }
    return %RString
  }
  else {
    echo 2 -a * /rs: Invalid parameters.  No request specified.
  }
}

Comments

Sign in to comment.
EliteT0kr   -  Oct 08, 2004

thx sigh_ didnt think of that, i changed it to if ($0 == 3) nowhere in mIRC help does it mention $0, ive never even knew its function

 Respond  
Sigh_   -  Oct 08, 2004

A good idea, only thing I\'d fault is the use of checking if ($1) && ($2) && ($3) to make sure 3 parameters were specified. It fails if I want to choose 0 as the beginning of a range, i.e. $rs(10,0,9) to get 10 random numbers since if (0) is false. A better method to check 3 parameters have been supplied is to see if ($0 = 3) where $0 returns the number of params passed to the alias

 Respond  
Pandaman   -  Oct 07, 2004

And the point of this is?

 Respond  
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.