application.js: randomKey function optimization (#13826)
Contributed by Filou Centrinov. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11741 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
932380b284
commit
86442e60ed
@ -431,10 +431,10 @@ function scmEntryClick(id, url) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function randomKey(size) {
|
function randomKey(size) {
|
||||||
var chars = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
|
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
||||||
var key = '';
|
var key = '';
|
||||||
for (i = 0; i < size; i++) {
|
for (var i = 0; i < size; i++) {
|
||||||
key += chars[Math.floor(Math.random() * chars.length)];
|
key += chars.charAt(Math.floor(Math.random() * chars.length));
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user