???????????????÷????????????????????????????????????????????????????????????????????????????????????α??????????滹?и?????????????????????????
????2??????????????($RANDOM)
?????????linux??????и?????????????????????????????????????????????????????????
????[chengmo@centos5 shell]$ echo $RANDOM
????10918
????[chengmo@centos5 shell]$ echo $RANDOM
????10001
????#????2?η??????????????????????????С??????5λ??????
????????????????????????5λ????????????????
??????????????10λ????????????????????1 ???????????????????????????????????????
????3?????????????????????????/dev/random??urandom)
???????????dev?????棬??linux?Щ????豸??????????о??????????????????????豸?????????? ???linux??Щ?豸??????????????????????????????/dev/[udp|tcp]/host/port???????ɡ??????г?????
????/dev/random?豸???洢??????????е?????????????????????????????????????????????????????????????????????????????????????????????/dev/urandom????豸??????random?????????????????????????????????????????????????????????
?????????
????[chengmo@centos5 shell]$ head -1 /dev/urandom
???????ù…?KTt?anV??1?&???“?2íùU“ ?F|_ ?”?mEe?Urá?=J??T?A?ìAúRtó
????#????У??????????????????????????????????????????????????????????????????????????
????[chengmo@centos5 ~/shell]$ head -200 /dev/urandom | cksum
????1615228479 50333
????#????urandom??????????????????????cat???????????200?У???????????????仯????????????????
????#cksum ????????????????????????????????????????????????????仯????php crc????
????[chengmo@centos5 shell]$ head -200 /dev/urandom | cksum | cut -f1 -d" "
????484750180
????#cut ??” “???????????????????????
???????????????????????????????????????????? ??????????????棬???????md5???????????????????????????????????????????crc????.crc?????????У?飬?????????????????????????????????????????????ú?????????????ο???crc.
???????滹?и????????????豸?????????uuid??
????4?????linux ??uuid??
????????????????и???????????uuid???
????UUID??????????????? (Universally Unique Identifier?? UUID)???? ????????????????????????????????? (Open Software Foundation?? OSF) ???????????????? (Distributed Computing Environment?? DCE) ???????????
????UUID ?????????÷??????е??????????????е?????????????????????????????????????????????????????????????????????????????? UUID??????????????£????迼??????????????????????????????????κ???????????????uuid??????????????????????????е?????????????????????????????????????????
????UUID??????????32??16??λ???????“-”?????????Σ?????8-4-4-4-12??32?????????????550e8400-e29b-41d4-a716-446655440000 ???????UUID????????????216 x 8=2128???????3.4 x 1038?? ??????????????1???UUID?????100??????????UUID????
???????????????????????????????????guid(???????)???????????uuid?????????????? ????????????в?????????????????e????windows???棬?????????????????????????????????uuid????
????linux ??uuid??
????linux??uuid?????????????????/proc/sys/kernel/random/uuid??????????????random???????滹?к???????????????????uuid?й?????
????[chengmo@centos5 ~/shell]$ cat /proc/sys/kernel/random/uuid
????dff68213-b700-4947-87b1-d9e640334196
????[chengmo@centos5 ~/shell]$ cat /proc/sys/kernel/random/uuid
????7b57209a-d285-4fd0-88b4-9d3162d2e1bc
????#????2?ζ?????????uuid??????
????[chengmo@centos5 ~/shell]$ cat /proc/sys/kernel/random/uuid| cksum | cut -f1 -d" "
????2141807556
????#????????????????
????????linux???棬???????????????????????????????????????????3??????????????α?????????????/dev/random?豸?й??????????????????????????????и?????????????????????????????????