Add a seedable UUIDv4 generator
Most UUID generators assume that you want fully random UUIDs. In most cases, this is true. The `uuid` package allows a consumer to pass in `random` values (an array of 16 numbers 0-255), or a generator that outputs 16 random bytes. This is our hook into being able to provide "random" values. We just need a way to get "random" values that are actually random in most cases, but that we can control if we want to. Enter: the Mersenne Twister. Mersenne Twisters can be seeded with a number to start. They will derive all of their future twisted states from that initial seed. So: we still get "randomness," but we can also seed it to make the output deterministic. This `random.js` file outputs a single function (for now) called `uuids` that will generate a random UUIDv4 string or - if provided seeds - will generate the correct resulting UUIDv4 given those seeds. Consumers can request multiple values to avoid having to constantly call the function and/or constantly reconstruct the internal Twister.
Showing
... | ... | @@ -102,6 +102,7 @@ |
"lodash": "^4.17.15", | ||
"marked": "^0.3.12", | ||
"mermaid": "^8.5.1", | ||
"mersenne-twister": "1.1.0", | ||
"mitt": "^1.2.0", | ||
"monaco-editor": "^0.18.1", | ||
"monaco-editor-webpack-plugin": "^1.7.0", | ||
... | ... | @@ -120,6 +121,7 @@ |
"sortablejs": "^1.10.2", | ||
"sql.js": "^0.4.0", | ||
"stickyfilljs": "^2.1.0", | ||
"string-hash": "1.1.3", | ||
"style-loader": "^1.1.3", | ||
"svg4everybody": "2.1.9", | ||
"swagger-ui-dist": "^3.24.3", | ||
... | ... | @@ -133,6 +135,7 @@ |
"tributejs": "4.1.3", | ||
"unfetch": "^4.1.0", | ||
"url-loader": "^3.0.0", | ||
"uuid": "8.1.0", | ||
"visibilityjs": "^1.2.4", | ||
"vue": "^2.6.10", | ||
"vue-apollo": "^3.0.3", | ||
... | ... |
Please register or sign in to comment