$rand() addition.

By sladekraven on Mar 02, 2006

The mIRC's $rand() identifier doesn't work with letters as it does with numbers.

//echo -a $rand(111,999) - Returns 346
//echo -a $rand(aaa,zzz) - Returns a

Now using $rand2()

//echo -a $rand2(111,999) - Returns 301
//echo -a $rand2(aaa,ccc) - Returns bca

alias rand2 {  
  if (($1 && $2) isnum) { return $rand($1,$2)  }   
  else { return $replace($($str($!rand($1,$2) $+ $chr(32),$len($1)),3),$chr(32),$chr(3)) } 
}

Comments

Sign in to comment.
Nerd   -  Mar 02, 2006

DarthReven: $rand does work with letters but infact it always returns a single letter, even if you use $rand(aaa,zzz)
that\'s what this snippet is supposed to fix

 Respond  
QuickStep   -  Mar 02, 2006

$rand2(aa,za) should return \'random letter\' + a, in stead it returns 2 random letters.

 Respond  
DarthReven   -  Mar 02, 2006

acutally $rand does work with letters

 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.