MaxScript几种的类GUID生成

自带的GUID

genGuid()
"{15B0BF56-2516-492C-A09F-C6E54B62A8C8}"
"{E1A1B14F-4B7D-453A-858E-FF071BF6961B}"
"{E1A1B14F-4B7D-453A-858E-FF071BF6961B}"

利用C#制造的GUID

c# code:
Guid.NewGuid().ToString()    : 1f13a943-4c7e-4bfc-aac5-935886591424
Guid.NewGuid().ToString("N"): 3a81013f9ee549b38f11ee3d50f5bd78
Guid.NewGuid().ToString("D"): c4219375-c2c8-4639-86e8-8d910ed12186  -- 默认为:D
Guid.NewGuid().ToString("B"): {a793927d-9a1b-4d25-9562-0a59522db9c0}
Guid.NewGuid().ToString("P"): (a99839b9-da94-40fd-87a5-4a5e73677b1f)
Guid.NewGuid().ToString("X"): {0xb294a44e,0x43d9,0x4b60,{0xb5,0xb9,0x32,0x29,0xae,0x46,0x45,0x17}}

mxs code:
((dotnetClass "System.Guid").NewGuid()).ToString()
"a0e62eb6-d9ae-4569-b246-2e37b92ae4e8"
((dotnetClass "System.Guid").NewGuid()).ToString("N")
"01f2b0a3bb2443b9850f825769cec39d"

其他需要随机但对重复要求不要的快速操作

内置时间戳:
(timeStamp())as string
"42657036"
(timeStamp())as string
"42661790"

或者试用随机:
(random 10000000 99999999) as string
"44219828"
(random 10000000 99999999) as string
"18699199"
上一篇:的GUID可以是一个很好的分区键?


下一篇:[小技巧]EF Core中如何获取上下文中操作过的实体