Version-1 UUIDs yog tsim los ntawm lub sijhawm thiab tus lej ID (feem ntau yog qhov chaw nyob MAC); version-2 UUIDs yog tsim los ntawm tus cim (feem ntau yog pab pawg lossis tus neeg siv ID), sijhawm, thiab tus lej ID; versions 3 thiab 5 tsim kev txiav txim siab UUIDs tsim los ntawm hashing tus cim npe thiab lub npe; thiab version-4 UUIDs raug tsim tawm…
V4 li UUID yog dab tsi?
V4: Randomness Cov khoom uas suav nrog UUID v4 yog tsim los ntawm random thiab tsis muaj qhov xav tau. Vim li no, tsis muaj txoj hauv kev los txheeb xyuas cov ntaub ntawv hais txog qhov chaw los ntawm kev saib UUID. Txawm li cas los xij, tam sim no muaj lub sijhawm uas UUID tuaj yeem muab luam tawm.
UUID V4 puas tuaj yeem luam tawm?
Version 4 is tus lej random UUID. Muaj 6 qhov ruaj khov thiab qhov seem ntawm UUID yog 122-ntsis ntawm randomness. Saib Wikipedia lossis lwm yam kev tshuaj xyuas uas piav qhia txog qhov tsis zoo li qhov sib npaug.
UUI suav li cas?
Txhua tus cim tuaj yeem ua tus lej 0 txog 9, lossis tsab ntawv a txog f. 32 hexadecimal x log2(16) bits/hexadecimal=128 bits in a UUID. Hauv version 4, qhov sib txawv ntawm 1 hom UUID, 6 cov khoom raug kho thiab qhov seem 122 cov khoom raug tsim tawm, rau tag nrho ntawm 2¹²² ua tau UUIDs. Peb mam li xa tus nqi no li n.
Java UUID tsim tawm li cas?
Methods of UUID class
The randomUUID method randomly tsim UUID. Thaum twg peb khiav qhov program, nws tsim UUID tshiab. Kev kos npe ntawm txoj kev yog: pej xeem zoo li qub UUID randomUUID