On Tue, Jun 21, 2011 at 3:39 AM, Nathan Kitchen <[email protected]> wrote: > Hi. > I'm not sure if this is the place to raise this, it's basically a request > for consideration of an API which I don't believe exists and would probably > be most useful within web apps: a UUID generator. > Earlier this week I hit a real-world issue where I needed to generate a UUID > from JavaScript. It's possible to do this using Math.random, but these > aren't guaranteed unique in the same way as version 1 UUID's (generated via > a time-based algorithm). Decent write-up here (not mine): > http://www.broofa.com/2008/09/javascript-uuid-function/
I doubt exposing MAC addresses would be considered for a web API, for privacy reasons. The probability of a collision with random (version 4) UUIDs is small enough to be acceptable for the overwhelming majority of uses. You do need a cryptographic-quality random number source for that, which there's been work on recently. You definitely don't want to use Math.random for this. -- Glenn Maynard
