UNPKG
@sontrx/typia
Version:
latest (7.6.4)
7.6.4
7.6.3
Superfast runtime validators with only one line
typia.io
samchon/typia
@sontrx/typia
/
src
/
internal
/
_randomFormatUuid.ts
7 lines
(6 loc)
•
234 B
text/typescript
View Raw
1
2
3
4
5
6
7
export
const
_randomFormatUuid = ():
string
=>
"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
.
replace
(
/[xy]/g
,
(
c
) =>
{
const
r = (
Math
.
random
() *
16
) |
0
;
const
v = c ===
"x"
? r : (r &
0x3
) |
0x8
;
return
v.
toString
(
16
); });