SHARE
TWEET

Untitled

a guest Feb 12th, 2012 166 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #per: http://stackoverflow.com/a/853882/747749
  2. #test generating a random string with concatenation. 100,000 runs
  3. time php -r 'function r($length = 16, $charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {$str = "";$count = strlen($charset);while ($length--) {$str .= $charset[mt_rand(0, $count-1)];}echo $str.PHP_EOL;}for($i=0;$i<100000;$i++)r();' > /dev/null
  4.  
  5. #test generating a random string with implode. 100,000 runs
  6. time php -r 'function r($length = 16, $charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {$count = strlen($charset);while ($length--) {$str[] = $charset[mt_rand(0, $count-1)];}echo implode($str).PHP_EOL;}for($i=0;$i<100000;$i++)r();' > /dev/null
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