Last active
September 29, 2016 02:05
-
-
Save reqshark/4e2ba500ab3c253c628e99f3029e4c99 to your computer and use it in GitHub Desktop.
small identifier derived from a single UUID 8 character hex component
This file contains hidden or 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
console.log( suuid() ); // somethiing like 'e1bdadd6' | |
function suuid() { | |
var sm = [], i = 256; | |
while (i--) | |
sm[ i ] = ( i < 16 ? '0' : '' ) + ( i ).toString( 16 ); | |
var uu = Math.random() * 0xffffffff | 0; | |
return sm[ uu & 0xff ] + | |
sm[ uu >> 8 & 0xff ] + | |
sm[ uu >> 16 & 0xff ] + | |
sm[ uu >> 24 & 0xff ]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment