• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 860
  • Last Modified:

Javascript UUID creator

Hello!

This is a fairly straight forward question.  I need a way to generate a UUID in javascript that is guarenteed to be unique from the instantiation of the script until it's end.  It will need to generate multiple UUIDs as well.  Thanks!
0
skacore
Asked:
skacore
  • 2
2 Solutions
 
skacoreAuthor Commented:
I need a corss browser compatible solution.
0
 
mshogrenCommented:
Do you need to generate UUID's according to the standards?
http://en.wikipedia.org/wiki/UUID

Or do you just need unique random numbers?  Do these numbers need to be a certain length?  It is certainly possible to create unique random numbers in Javascript as found here:
http://javascript.internet.com/miscellaneous/unique-random-numbers.html

You would just need to create a number in the range of values that corresponds to a 32 hexadeciaml number and then convert it to the notation you want.
0
 
AF-DesignCommented:
You might check out this solution to see if it suits your needs.

http://www.af-design.com/resources/javascript_uuid.php 

No JavaScript solution will ever be a true UUID so long as the browsers sandbox doesn't provide access to low level devices (to fetch MAC address of the NIC etc) but this is a best effort to match as much of the standard as possible in a JavaScript class.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now