daily pastebin goal
47%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // -------------------------------------------------------
  2. // this function returns a random string with k length
  3. // -------------------------------------------------------
  4. function random_string($k) {
  5.     $str = "";
  6.     for ($i=0;$i<$k;$i++) {
  7.         $randnum = mt_rand(0,61);
  8.             if ($randnum < 10)
  9.                 $str .= $randnum;
  10.             else if ($randnum < 36)
  11.                 $str .= chr($randnum+55);
  12.             else
  13.                 $str .= chr($randnum+61);
  14.     }
  15.     return $str;
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top