Created
September 20, 2020 20:29
-
-
Save sccolbert/6f54e37ebe1f1b260a17d81a85340a4f to your computer and use it in GitHub Desktop.
Unique ID Generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A function which takes no arguments and returns a unique string ID. | |
* | |
* Requirements: | |
* - The id must be unique for the current process only | |
* - The id should avoid hashing collisions when used as a key in a map | |
* - The function must not create global variables | |
* - The value of `Math.random()` cannot be assumed to be unique | |
* - The browser `Crypto` object may not be used | |
*/ | |
const createUID = ... | |
// Example Usage | |
console.log(createUID()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment