starboard-notebook
Version:
Starboard Notebook
15 lines • 602 B
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
function dec2hex(dec) {
return dec < 10 ? "0" + String(dec) : dec.toString(16);
}
export function generateUniqueId(length) {
const arr = new Uint8Array((length || 40) / 2);
crypto.getRandomValues(arr);
return Array.from(arr, dec2hex).join("");
}
export function generateUniqueCellId() {
return "cell-" + generateUniqueId(12);
}
//# sourceMappingURL=random.js.map