Files
tubestation/browser/extensions/screenshots/webextension/randomString.js
Mark Banner d2d9626164 Bug 1346825 - Import Screenshots version 6.3.0 into mozilla-central. rs=Mossop.
This is imported from https://github.com/mozilla-services/screenshots/.
It has been reviewed as patches landed, but also reviewed by Mossop and kmag.
This also includes the patch from bug 1356394

MozReview-Commit-ID: FXIVw7WjxlN
2017-04-13 09:49:17 +01:00

15 lines
376 B
JavaScript

/* exported randomString */
"use strict";
this.randomString = function randomString(length, chars) {
let randomStringChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
chars = chars || randomStringChars;
let result = "";
for (let i=0; i<length; i++) {
result += chars[Math.floor(Math.random() * chars.length)]
}
return result;
}
null;