JS UUID

関数UUID(){ 
CONST S = [];
CONST hexDigits = "0123456789ABCDEF"。
ため(LET I = 0; iが36 <; iは++){
S [I] = hexDigits.substr(Math.floor(Math.random()* 0×10)、1)。
}
S [14] = "4"。//ビット0010にtime_hi_and_versionフィールドの12-15
S [19] = hexDigits.substr((S [19]&0x3の)| 0x8という、1)。//ビットclock_seq_hi_and_reservedの6-7への01
S [8] =のS [13] =のS [18] =のS [23] = " - "。
リターンs.join( "");
}

おすすめ

転載: www.cnblogs.com/xlizi/p/11741770.html