Generates unique ids. window.crypto is used when available, otherwise Math.random() is used as a fallback. Returns an unique id of length characters. Returned uids are base-64 encoded. Characters - and _ are used as the 63th and 64th character of the base, to allow use in URLs, CSS class names, etc.