Created
May 27, 2019 13:08
-
-
Save simonkberg/ae5fcdeac91fbc8d9e4d524862597ecb to your computer and use it in GitHub Desktop.
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
const srand32 = seed => { | |
const s = Math.sin(seed) * 10000; | |
return Math.floor((s - Math.floor(s)) * Math.pow(2, 32)); | |
}; | |
const suuid = seed => | |
new Uint32Array(8) | |
.map((_, idx) => srand32(seed + idx)) | |
.reduce((acc, val, idx) => acc + (idx < 2 || idx > 5 ? '' : '-') + val.toString(16).slice(-4), ''); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment