What does time or position have to do with uniqueness? Why not velocity, spin and charm? Seriously, given a good source of entropy, a large enough random number is globally unique.
Math.random() is not a good source of entropy, but crypto.getRandomValues is. See <http://wiki.whatwg.org/wiki/Crypto>. On Thu, Mar 22, 2012 at 3:30 AM, 程劭非 <csf...@gmail.com> wrote: > UUID is not only a random Number or String. It has to contain time and > position to make itself unique in the world. > > It looks Math.random is related to time. We have no way to involve > position information to JS currently. > > 2012/3/16 Nuno Job <nunojobpi...@gmail.com>: > > Wrong list, sorry about that :) > > > > > > On Thu, Mar 15, 2012 at 4:34 PM, Nuno Job <nunojobpi...@gmail.com> > wrote: > >> > >> (~~(Math.random() * 1e9)).toString(36) + Date.now(); > >> > >> > >> On Thu, Mar 15, 2012 at 4:33 PM, Rick Waldron <waldron.r...@gmail.com> > >> wrote: > >>> > >>> Axel, > >>> > >>> Have you ever seen > >>> this? http://www.broofa.com/2008/09/javascript-uuid-function/ > >>> > >>> I've been using this for several years > >>> > >>> > >>> Rick > >>> > >>> > >>> On Thu, Mar 1, 2012 at 5:45 PM, Axel Rauschmayer <a...@rauschma.de> > >>> wrote: > >>>> > >>>> UUIDs are useful for many tasks. One cannot create good ones in > >>>> JavaScript without browsers exposing more of the underlying platform. > Would > >>>> it make sense to add UUID generation to ECMAScript.next? Or is that > >>>> something for a browser API? > >>>> > >>>> Axel > >>>> > >>>> -- > >>>> Dr. Axel Rauschmayer > >>>> a...@rauschma.de > >>>> > >>>> home: rauschma.de > >>>> twitter: twitter.com/rauschma > >>>> blog: 2ality.com > >>>> > >>>> > >>>> _______________________________________________ > >>>> es-discuss mailing list > >>>> es-discuss@mozilla.org > >>>> https://mail.mozilla.org/listinfo/es-discuss > >>>> > >>> > >>> > >>> _______________________________________________ > >>> es-discuss mailing list > >>> es-discuss@mozilla.org > >>> https://mail.mozilla.org/listinfo/es-discuss > >>> > >> > > > > > > _______________________________________________ > > es-discuss mailing list > > es-discuss@mozilla.org > > https://mail.mozilla.org/listinfo/es-discuss > > > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > -- Cheers, --MarkM
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss