Created
March 13, 2015 11:04
-
-
Save dhirajforyou/1ade3b045ec566e50c03 to your computer and use it in GitHub Desktop.
Javascript Random Number Generator Function
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
/* | |
Attaching the time stamp so that based on the returned value , we can find out when it is generated | |
*/ | |
function _Random(){ | |
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx-te'.replace(/[xye]/g, function (c) { | |
var r = Math.random() * 16 | 0; | |
if(c == 'e'){ var t = (new Date).getTime(); v = t} | |
else{var v = c == 'x' ? r : (r & 3 | 8);} | |
return v.toString(16); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment