Monday, June 18, 2012

To generate UUID in javascript


function S4() {
  return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}
function generateGUID() {
  return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
}