[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 853
  • 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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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