Created
January 16, 2013 06:33
-
-
Save makotoworld/4545099 to your computer and use it in GitHub Desktop.
Revisions
-
makotoworld created this gist
Jan 16, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ //JSでランダムなキーをつくる var randobet = function(n, b) { b = b || ''; var a = 'abcdefghijklmnopqrstuvwxyz' + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + '0123456789' + b; a = a.split(''); var s = ''; for (var i = 0; i < n; i++) { s += a[Math.floor(Math.random() * a.length)]; } return s; }; // randobet(10, '-_!'); // 2OM_g0-76n