Here you can find the source of generateRandomId(length)
function generateRandomId(length) { "use strict"; var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", returnValue = "", x, i; for (x = 0; x < length; x += 1) { i = Math.floor(Math.random() * 62); returnValue += chars.charAt(i);//w ww . j a va 2s . c o m } return "JS_" + returnValue; }