Skip to content

Instantly share code, notes, and snippets.

@RobinThrift
Last active December 21, 2015 14:09
Show Gist options
  • Save RobinThrift/6317196 to your computer and use it in GitHub Desktop.
Save RobinThrift/6317196 to your computer and use it in GitHub Desktop.
SImple random string of 5 characters (JS/PHP) src: http://stackoverflow.com/a/8084248
function randStr() {
return Math.random().toString(36).substring(7);
}
<?php
function randStr() {
$r = (string) mt_rand(5535, time())*150;
return base_convert($r, 10, 36);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment