forked from ddrilling/asb_cloud_front
13 lines
536 B
TypeScript
Executable File
13 lines
536 B
TypeScript
Executable File
export function generateUUID():string {
|
|
let seed = (25869874412483
|
|
* new Date().getTime()
|
|
* (performance && performance.now && (performance.now()))) % 173395562924509
|
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
|
let random = Math.random()
|
|
seed = seed > 272
|
|
? seed = seed / 17
|
|
: seed = (seed * random * random * 557833831325167) % 173395562924509
|
|
random = Math.floor((random * seed) % 16)
|
|
return (c === 'x' ? random : (random & 0xB)).toString(16)
|
|
})
|
|
} |